Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery库与函数冲突_Jquery - Fatal编程技术网

jQuery库与函数冲突

jQuery库与函数冲突,jquery,Jquery,我通过javascript使用动态菜单,如下所示 <script type="text/javascript"> ddaccordion.init({`enter code here` //top level headers initialization headerclass: "expandable", //Shared CSS class name of headers group that are expandable contentclass: "cat

我通过javascript使用动态菜单,如下所示

<script type="text/javascript">


ddaccordion.init({`enter code here` //top level headers initialization
    headerclass: "expandable", //Shared CSS class name of headers group that are expandable
    contentclass: "categoryitems", //Shared CSS class name of contents group
    revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
    animatedefault: false, //Should contents open by default be animated into view?
    persiststate: true, //persist state of opened contents within browser session?
    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    togglehtml: ["suffix", "<img src='<?php echo $this->baseurl; ?>/images/up.png' class='statusicon' />", "<img src='<?php echo $this->baseurl; ?>/images/down.png' class='statusicon'/>"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
        //do nothing
    },
    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
        //do nothing
    }
})
</script>

ddaccordion.init({`enter code here`//顶级头初始化
headerclass:“expandable”,//可扩展的Header组的共享CSS类名
contentclass:“categoryitems”,//内容组的共享CSS类名
revealtype:“clickgo”//当用户在标题上单击鼠标或鼠标时显示内容?有效值:“click”、“clickgo”或“mouseover”
mouseoverdelay:200,//如果revealtype=“mouseover”,则在标头在mouseover上展开之前以毫秒为单位设置延迟
collapseprev:true,//折叠以前的内容(因此在任何时候只打开一个)?true/false
defaultexpanded:[],//默认打开的内容索引[index1、index2等].]表示没有内容
onemustopen:false,//指定是否至少有一个标头应始终打开(因此从不关闭所有标头)
animatedefault:false,//默认情况下打开的内容是否应动画显示到视图中?
persiststate:true,//浏览器会话中打开内容的持久状态?
toggleclass:[“”,“openheader”],//两个CSS类,分别在头折叠和展开时应用于头[“class1”,“class2”]
切换HTML:[“后缀”、“baseurl;”?>/images/up.png'class='statusicon'/>“,“baseurl;”?>/images/down.png'class='statusicon'/>“],//在收拢和展开标题时分别向标题添加额外的HTML[“位置”、“html1”、“html2]”(参见文档)
animatespeed:“快”//动画速度:以毫秒为单位的整数(即:200),或关键字“快”、“正常”或“慢”
oninit:function(headers,expandedindices){//在头初始化时运行的自定义代码
//无所事事
},
onopenclose:函数(头、索引、状态、isuseractivated){//在打开或关闭头时运行的自定义代码
//无所事事
}
})
使用ddaccordion.js库。当我将鼠标悬停在主菜单上时,我的子菜单将通过javascript显示在弹出窗口中,如下所示

<script type="text/javascript">
jQuery.noConflict();
    var showQV = function(node) {
        node.fadeIn();
    };

    var hideQV = function(node) {
        node.fadeOut();
    };
    $(document).ready(function () {     
        var t1,t2;
        t1 = t2 = null;
        var currentQuickView = null;
        $(".popup_menu").hover(function() {


            clearTimeout(t2);
            var that = this;
            t1 = setTimeout(function() {
                currentQuickView && (currentQuickView.get(0) != $($(that).attr("popUpSelect")).get(0)) && hideQV(currentQuickView);
                currentQuickView = $($(that).attr("popUpSelect"));
                showQV($($(that).attr("popUpSelect")));
            }, 500);
        },
                function() {
                    var that = this;

                    clearTimeout(t1);
                    t2 = setTimeout(function() {
                        hideQV($($(that).attr("popUpSelect")));
                    }, 500);
                });

        $(".popUpView").hover(function() {
            clearTimeout(t2);
            var that = this;
            t1 = setTimeout(function() {
                showQV($(that));
            }, 500);
        },
                function() {
                    var that = this;
                    clearTimeout(t1);
                    t2 = setTimeout(function() {
                        hideQV($(that));
                    }, 500);
                });


        $(".jqVertTabs").click(function() {
            if (!$(this).hasClass("genTabOpen")) {
                var oldSelected = $(".genTabOpen");
                var newSelected = $(this);
                var oldTabId = parseInt(oldSelected.attr("tabId"));
                var newTabId = parseInt(newSelected.attr("tabId"));
                oldSelected.removeClass("genTabOpen").addClass("genTabClose");
                $(oldSelected.children()[0]).removeClass("tbOpen").addClass("tbClose");
                $(this).removeClass("genTabClose").addClass("genTabOpen");
                var child = $(this).children()[0];
                $(child).removeClass("tbClose").addClass("tbOpen");
                $(".arrowList", oldSelected.parent()).slideUp();
                $(".arrowList", newSelected.parent()).slideDown();

            }
        });
    });
</script>

jQuery.noConflict();
var showQV=函数(节点){
node.fadeIn();
};
var hideQV=函数(节点){
node.fadeOut();
};
$(文档).ready(函数(){
变量t1,t2;
t1=t2=null;
var currentQuickView=null;
$(“.popup_菜单”).hover(函数(){
清除超时(t2);
var=这个;
t1=设置超时(函数(){
currentQuickView&(currentQuickView.get(0)!=$(that.attr(“popUpSelect”).get(0))&&hideQV(currentQuickView);
currentQuickView=$($(that.attr(“popUpSelect”);
showQV($($(that.attr(“popUpSelect”));
}, 500);
},
函数(){
var=这个;
清除超时(t1);
t2=设置超时(函数(){
hideQV($($(that.attr(“popUpSelect”));
}, 500);
});
$(“.popUpView”).hover(函数(){
清除超时(t2);
var=这个;
t1=设置超时(函数(){
showQV($(那));
}, 500);
},
函数(){
var=这个;
清除超时(t1);
t2=设置超时(函数(){
hideQV($(那));
}, 500);
});
$(“.jqVertTabs”)。单击(函数(){
if(!$(this).hasClass(“genTabOpen”)){
var oldSelected=$(“.genTabOpen”);
var newSelected=$(本);
var oldTabId=parseInt(oldSelected.attr(“tabId”);
var newTabId=parseInt(newSelected.attr(“tabId”);
oldSelected.removeClass(“genTabOpen”).addClass(“genTabClose”);
$(oldSelected.children()[0]).removeClass(“tbOpen”).addClass(“tbClose”);
$(this.removeClass(“genTabClose”).addClass(“genTabOpen”);
var child=$(this.children()[0];
$(child).removeClass(“tbClose”).addClass(“tbOpen”);
$(“.arrowList”,oldSelected.parent()).slideUp();
$(“.arrowList”,newSelected.parent()).slideDown();
}
});
});

使用main-menu.js。它在Firefox和IE中运行良好,但在chrome中存在冲突。因此,任何已知的解决方案都可以帮助我。

不要调用
jQuery.noConflict()
。它删除了作为jQuery快捷方式的
$
。您不需要这样做,
$
与其他内容没有冲突。首先加载jQuery,然后加载ddaccordion,然后加载自定义jQuery代码