jQuery compatibilities and animate-bg

Permalink
Hello everyone,

I'm struggling to get something to work on my website, I have a menu that needs to call a js script to work and use some backgroundPosition functions from jquery. The thing is that I can't get it to work with latest version of Concrete that is actually using jquery 1.4.1. However, if remove the Loader:element from the header and call the jquery.js 1.4.2 my menu will work. I was thinking of changing the version of jquery then from concrete and make it to work with jquery 1.4.1 instead but I think this is too risky as some concrete funcionalities might not work.

This is what I have:

<?php Loader::element('header_required'); ?>

<!-- Custom JavaScript -->
<script src="<?=$this->getThemePath()?>/javascripts/custom.js" type="text/javascript"></script>
<script src="<?=$this->getThemePath()?>/javascripts/animate-bg.js" type="text/javascript"></script>


So if I remove the first line and call the jquery.js my menu works perfectly but of course I can't do this cause otherwise I won't have access to the dashboard and concrete header.
Any suggestions on this guys please of what can I do here to get my menu work properly?

 
JohntheFish replied on at Permalink Reply
JohntheFish
You need to see what the developer console is reporting when the page loads. I suspect you are either ending up with 0 or 2 copies of jQuery.

C5 will load jQuery itself for many things, but you can't depend on that (you could end up with something that works when logged in, but not for casual visitors). If you use the html helper and addHeaderItem (before loading header_required), then you can simply tell C5 to load jQuery and it will filter out any duplication for you. One of the jobs of header_required is to assemble all the scripts and css from addHeaderItem calls.

Personally, I would have developed a custom menu as a block rather than building it into a template, then put it into a global area (I like to keep my lego bricks smaller). However, both approaches are possible and I know many theme specialists build menus directly into themes.

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.