• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

can I delete out one line of code that is inherited from a template?

Explorer ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

I have a template that I recently updated the jquery script link to https://code.jquery.com/jquery-3.3.1.min.js

However I have found that this library breaks my accordions on about 5 pages in the site.  I need to temporarily link to the 2.2.1 jquery library until I have time to update the 5 pages with new accordion code that will work with jquery 3.3.1.

However I only want to revert those 5 pages in particular to jquery 2.2.1.  The reference from the template is making the 3.3.1 no editable (as usually is what is wanted).

Can I delete out the 3.3.1 code from the 5 pages or is there some way to make a 2.2.1 script code link reference override the 3.3.1 link?

Views

288

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 10, 2018 Apr 10, 2018

https://forums.adobe.com/people/Johnny+the+boy  wrote

I am not sure the significance of placing JS link files at the very bottom of the body versus placing them in the <head> section at the top.  Does this make any difference on when the scripts get loaded?

Putting JS scripts at the bottom of your documents improves page load speed.   The point is to defer scripts until the page content and layout have loaded in browser first.

When I encounter conflicts, I revert to the older script library or  I a

...

Votes

Translate

Translate
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

Does 3.3.1 break the accordions when replacing the 2.2.1 link, or when added to a page that already has a 2.2.1 link?

Calls for two separate versions of jQuery will usually break the functionality whereas replacing an older script link with a newer typically doesn't.

To make your scripts editable, make an editable region in the <head> of your Template (if it's not already there). Put the .js links within your <head> section's editable region, they won't propagate to your Child pages when you save, but you can then add whatever scripts you like within that section of the <head> of every child with a simple copy/paste.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

Jon,

Yes when I replaced the 2.2.1 link with the 3.3.1 then that broke the accordion that was previously working fine using 2.2.1.  The accordions would no longer open.

The head region is editable and I have some links to CSS and JS in the head region.  For some reason I have the jQuery 2.2.1/3.3.1 link at the very bottom of the body just before the closing </body> tag.

I am not sure the significance of placing JS link files at the very bottom of the body versus placing them in the <head> section at the top.  Does this make any difference on when the scripts get loaded?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

My advice really doesn't change much with this new information...

If I were being forced to use Templates within DW, and needed different scripts at the bottom of various pages, I'd make a new editable region at the end of the document, just before the closing </body> tag, and add a link to whichever script was right for a given page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

https://forums.adobe.com/people/Johnny+the+boy  wrote

I am not sure the significance of placing JS link files at the very bottom of the body versus placing them in the <head> section at the top.  Does this make any difference on when the scripts get loaded?

Putting JS scripts at the bottom of your documents improves page load speed.   The point is to defer scripts until the page content and layout have loaded in browser first.

When I encounter conflicts, I revert to the older script library or  I add jQuery Migrate which sometimes helps resolve conflicts.

https://blog.jquery.com/2016/05/19/jquery-migrate-1-4-1-released-and-the-path-to-jquery-3-0/

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

LATEST

in addition to what said nancy, and depending on your focus target, you can also place the SCRIPT tag in the document HEAD and add attributes DEFER and ASYNC

<script>: The Script element - HTML | MDN

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines