Jump to content

Archived

This topic is now archived and is closed to further replies.

hrachovec

Where to insert header <script>?

Recommended Posts

hrachovec

Hello:

 

This should be obvious, but I can't get to work. I'm trying to insert a script in the header of my DMS2 site. This script is supposed to make the page scroll to the top when you click the logo in the navigation. The script was supplied by a developer.

 

I've used the  Custom Scripts tab in the DMS interface and pasted my code in there (in the 'Custom Javascript or Header HTML' field). 

 

However I don't see the script in the code when I view the site in another browser. The script only seems to work when I'm logged into DMS in Chrome. 

 

Below is the script I'm trying to get in my header. Attached is a picture of where I'm placing it. 

 

it seems like the script isn't taking effect. Any ideas? 

 

Kind regards, Russell

<script>
(function($){
    $(document).ready(function(){
        var logoLink=$(".navi-left > a"),
            logoHref=logoLink.attr("href")+"#top";
        logoLink.attr({
            "href":logoHref,
            "rel":"m_PageScroll2id"
        });
    });
})(jQuery);
</script>

Share this post


Link to post
Share on other sites
Danny

Hi,

 

I have just this moment added your script to my test site, then published the changed and view the site in FireFox and I have no issue with the script loading when I am not logged in - https://cloudup.com/cUHrd0Z8zaR

Therefore, you have either not published the changes or you have a cache plugin or something similar causing an issue.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
hrachovec

Hi Danny:

 

Thanks for your reply. I've tested it again in a different browser (as I did the other day) and now it's working. Not sure why it wasn't working before, but it's fine now. 

 

Thanks! R

Share this post


Link to post
Share on other sites
Danny

No problem.

 

If it happens again, then you will probably want to disable all active plugins and see if this resolve the issue in the future.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • MiraAdmin
      By MiraAdmin+
      Looking for some help on a recently developed issue. Editor will not load. 
      Theme:  DMS2
      Error from:  Chrome - Inspector - console view
      Error message: Refused to execute script from 'http://xxxx.xxx/wp-content/themes/dms/dms/editor/js/gettext.js/?ver=4.9.7' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
      Occurs on all sites on same server. 
      WP versions to 4.9.5, 4.9.6, 4.9.7 = same behavior. Worked properly on these same versions until 07/04/2018.
      No new plugins. Isolating plugins offers same behavior. 
      Server vendor reports no changes, patches, etc. 
      Server re-starts no impact.  

      Thank you. 
    • Paul
      By Paul+
      I was surprised to see I had no menu today - out of the blue - its actually moved to the bottom of the page!  After hours of fiddling and disabling every single plugin, leaving just plagelines the issue is still present.  See video for a basic text box - I moved it into the head and it jumps to the bottom and shows just above the footer but below the main content.  I have a temp fix by placing the menu into the first row on the main content but it does mean other than my home page, all other pages have no menu.  A quick fix is very urgent for this bug.
      https://thelaptopfixers.com
       
       
    • russe-intensif
      By russe-intensif+
      Hi team,
      checking my site today, i'm surprised to see my MegaNav all in bottom of the pages, while it's in header.
      After getting to change it in couple of pages onto Template part (too time consuming !), i'm desperate and ask you for help :-)
      apprendre-le-russe-avec-ania.fr
      Thank you in advance !

    • tuciudadenred
      By tuciudadenred+
      Hi everyone, what happens is that the web page metrosalarmas.com has a google tags which I have not attacked where I can look to remove those tags and be able to locate the correct ones.
    • flourishdesignstudio
      By flourishdesignstudio+
      Hello,
      I have an older site that was built using PageLines several years ago (prior to the release of DMS). I wanted to leverage some of the power of your new PL5 plugin but the theme prevents be from adding any generated custom sidebars to the theme (through the drag and drop interface) and does not allow me to add any PL5 sections/containers/etc to the header or footer. Is there any way to easily override that or am I stuck only using PL5 in the content areas of the site?
      Thanks so much for the help!
×