How to use jQuery

When using jQuery in your templates (productlist, moreinfo or skins), we need to make sure only one instance of jQuery is loaded.
If jQuery gets loaded multiple times (for instance from different urls, or different versions), the second instance will overwrite the first, including any triggers or extensions which may have been loaded.

To prevent this from happening we have put two functions in place:

  1. When multiple lines including a script from the same url exist (for instance one from the skin and one from the productlist) then only one is rendered in the resulting html page
  2. To make sure jQuery is loaded persistent from the same url and version, there is a alias which can be used which automatically fills in the src attribute with the needed url

The extension which can be used for this is myshop-resource-alias:jquery:

<script type="text/javascript" src="myshop-resource-alias:jquery">&#160;</script>

This extension is used in our standard templates, so if you use it in any custom templates, it will ensure that jQuery works the way you expect it to.

Currently we use the 1.4.2 version of jQuery.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment