Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

How to ensure only one instance of jQuery is loaded?

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Hi, using the old JB Library it was easy to make sure only one instance of jQuery is loaded but how do you do it with Zen Grid 2? There are no options for it in the jQuery Options area.

I'm developing a site here, you'll see there are loads of JavaScript conflicts (the bane of my life these days! ;)

I'm hoping they'll be gone by only having one jQuery...
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
I think the template framework handles this in the same way the plugin did but it uses regex and there can be a few that slip through the net.

In K2 you can disable jquery in the parameters. You will then have to change the plugin order so the template framework is above k2 (system plugins).

In the template under settings -> performance at the bottom is an option to strip extra scripts. You can add anything here that you want removed from the site. So for you I would try

jquery-1.6.1.min.js
jquery.noconflict.js

Unless there is a way to turn them off in the component options?
  • Robert Went's Avatar
  • Robert Went
  • Moderator
  • 2210 posts
  • 196 Thanks
  • Karma: 90
The administrator has disabled public write access.
The following user(s) said Thank You: Mark Law
Thanks Robwent, I have done as you said, disabled jquery in K2, made sure Zentools loads before K2 and have excluded those duplicate files.

It seems to work fine, but now I have 10 errors on the page. You've answered my question though, so thanks :)

The site has moved to here now
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
Hi there,

I'm not sure where you see the errors, is that in firebug?

In your page I see K2.js loading before JQuery which will cause an error as JQuery isn't loaded before K2 tries to use it.

Can you check the order of plugins again. If zen is above K2 you might have to submit a ticket so we can look into it.

Sometimes there is no order to the plugins but it might look like one is above the other and they all have the ordering value of 0

Regards,
Rob
  • Robert Went's Avatar
  • Robert Went
  • Moderator
  • 2210 posts
  • 196 Thanks
  • Karma: 90
The administrator has disabled public write access.
Cool thanks Rob, the errors where in Firefox > Tools > Web Developer > Error Console

Same in Firebug too though, just more clicks ;)

You where right the ordering was set to zero.

Now there are only 4 errors which is a vast improvement, thanks :)
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
The errors seem to be coming from widgetkit.

Can you try switching that off and seeing if the errors are gone?
  • Robert Went's Avatar
  • Robert Went
  • Moderator
  • 2210 posts
  • 196 Thanks
  • Karma: 90
The administrator has disabled public write access.
Thanks, I'm no longer using widgetkit now so I've removed it, there are still errors though, it's probably from Aceshop, I'll check with them, thanks
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
Thanks for the update :)

Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
I think the error you see on the doctype is down to 2 script tags on the page with no defines source, I had to remove the opening < and ending tag so i could post but you get the idea.

script src="" type="text/javascript">

It's hard to tell what is outputting them though.

richardhulse.blogspot.co.uk/2008/10/javascript-console-syntax-error-on.html
  • Robert Went's Avatar
  • Robert Went
  • Moderator
  • 2210 posts
  • 196 Thanks
  • Karma: 90
The administrator has disabled public write access.
The following user(s) said Thank You: Mark Law
Excellent thanks Robwent, that has saved me hrs of time, I managed to track down one of the culprits. It was indeed Aceshop.

I shall continue on my quest for the other one, thanks for the heads up! :)
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
Hi
I see your quest was successful as I see only one instance now. You did good job with Rob
  • Zuzuzu's Avatar
  • Zuzuzu
  • LIfetime Developer - Big Bamboo
  • 1925 posts
  • 107 Thanks
  • Karma: 67
The administrator has disabled public write access.
I solved this problem by loading the JBLibrary extension here, and selecting the option to load only one instance of JQuery.
  • blueshift's Avatar
  • blueshift
  • 6 Month Developer
  • 2579 posts
  • 78 Thanks
  • Karma: 26
The administrator has disabled public write access.
Yes, I was able to do it through the template parameters with Robs help, the old JB Library was much easier though ;)

I'm trying to minimise what I need to install on the site, it's already gone way overboard ;)

Thanks everyone for your help! :)
  • Mark Law's Avatar
  • Mark Law
  • 12 Month basic
  • 78 posts
  • Karma: 1
The administrator has disabled public write access.
Thanks Mark.
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers