简体   繁体   English

冲突的jQuery-动态菜单会干扰jQuery加载的内容吗?

[英]Conflicting jQuery - Dynamic menu interferes with jQuery of content loaded?

At the moment I am using jquery.ba-hashchange.min.js and dynamicpage.js to load the content dynamically from the index page and therefore keeping the header in one file. 目前,我正在使用jquery.ba-hashchange.min.js和dynamicpage.js从索引页动态加载内容,因此将标头保存在一个文件中。 However, the jquery.ba-hashchange.min.js is interfering with other jQuery in my content. 但是,jquery.ba-hashchange.min.js正在干扰我内容中的其他jQuery。

The code in the content that is not working is as follows: 内容中无效的代码如下:

$(".thumbnails").on("mouseover mouseout", 'img', function () {
    var alt = $(this).attr('alt');
    $('.displayed-image > img').each(function(index, element) {
        var el = $(element),
            visibility = el.attr('alt') === alt ? 'visible' : 'hidden';
        el.css('visibility', visibility);
    });
});

This code makes hidden images visible when the user hovers over the thumbnails. 当用户将鼠标悬停在缩略图上时,此代码使隐藏的图像可见。 You can see this working here http://intelligen.info/instagram-randoms.html 您可以在这里查看此工作http://intelligen.info/instagram-randoms.html

However if you navigate to this content using the menu at the top of the index page here http://intelligen.info Personal > Instagram Randoms , the code is not working. 但是,如果您使用http://intelligen.info 个人> Instagram Randoms索引页顶部的菜单导航到此内容,则该代码不起作用。 Can anyone tell me how to make the code work with the menu? 谁能告诉我如何使代码与菜单一起使用?

Set no conflit in the used jquery 在使用的jquery中设置无限制

Example: 例:

 <script type="text/javascript" src="js/jquery-ui-1.10.4.custom.min.js"></script>


 <script> var jquery_ui_1_10_4_custom = $.noConflict(true); </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM