开发者

jQuery conflicts with another jQuery library

开发者 https://www.devze.com 2022-12-29 13:32 出处:网络
I am currently trying to implement a jquery slider into a joom开发者_StackOverflow社区la website.

I am currently trying to implement a jquery slider into a joom开发者_StackOverflow社区la website.

I already implemented NoConflict(); so that it doesn't step into joomla. And it works, BUT for another reason wich I do not understand it enters another jquery file called jsloader.js of a plugin I use for picture gallery display.

I suppose all the module jquery files get preloaded before the one im calling inside the template.

it enters the function() in the jsloader.js instead of the one in my jquery file.

How Can I force it to enter my jquery file instead of other


The first problem is that you've got the jquery.js file coming after the jsloader.js file. You need to make sure that jquery.js is included before any plugins - the order is important.

The second problem is that this:

<script type="text/javascript" src="//templates/template/js/jquery-1.2.6.min.js"></script>

Doesn't do what you think. When there are two slashes at the beginning of the URL, the browser interprets the first entry after the double-slash as the hostname, not a directory. What you actually want is:

<script type="text/javascript" src="/templates/template/js/jquery-1.2.6.min.js"></script>

With only one slash.

In case you're wondering, the reason for this is so that you can specify a file on a different host, but using the same scheme. So if you have a page that works in HTTP and HTTPS, then you can specify files on a different site, using the same scheme (HTTP vs. HTTPS) by using the src="//example.com/script/whatever.js" format.

0

精彩评论

暂无评论...
验证码 换一张
取 消