0

次のように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.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>

main-menu.js で。Firefox と IE で完全に動作します。しかし、クロムの競合。だから、これに対する既知の解決策は私を助けてくれます。

4

1 に答える 1

0

電話しないでくださいjQuery.noConflict()$jQuery のショートカットとして削除します。する必要はありません -他の$ものと競合していません。最初に jQuery をロードし、次に ddaccordion、カスタム jQuery コードをロードします。

于 2012-08-24T11:12:25.423 に答える