Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.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/2/jquery/75.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
Javascript JQuery复选框筛选问题_Javascript_Jquery - Fatal编程技术网

Javascript JQuery复选框筛选问题

Javascript JQuery复选框筛选问题,javascript,jquery,Javascript,Jquery,我正在尝试使用我的网页上已有的Javascript来实现这一点。这就是我想要的 但是,当将它添加到我已经存在的javascript中时,我无法将它添加到“过滤器”中 这是已经存在的 $(document).ready(function () { $(function() { var src = $('#productsBtn').attr("src").match(/[^\.]+/) + "_over.png"; $('#productsBtn').att

我正在尝试使用我的网页上已有的Javascript来实现这一点。这就是我想要的

但是,当将它添加到我已经存在的javascript中时,我无法将它添加到“过滤器”中

这是已经存在的

$(document).ready(function () {
    $(function() {
        var src = $('#productsBtn').attr("src").match(/[^\.]+/) + "_over.png";
        $('#productsBtn').attr("src", src);

        $(".sf-menu #homeNav a")
            .mouseover(function() { 
                var src = $('#homeBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#homeBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#homeBtn').attr("src").replace("_over.png", ".png");
                $('#homeBtn').attr("src", src);
            });

        $(".sf-menu #aboutNav a")
            .mouseover(function() { 
                var src = $('#aboutBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#aboutBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#aboutBtn').attr("src").replace("_over.png", ".png");
                $('#aboutBtn').attr("src", src);
            });

        $(".sf-menu #warrantyNav a")
            .mouseover(function() { 
                var src = $('#warrantyBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#warrantyBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#warrantyBtn').attr("src").replace("_over.png", ".png");
                $('#warrantyBtn').attr("src", src);
            });

        $(".sf-menu #solutionsNav a")
            .mouseover(function() { 
                var src = $('#solutionsBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#solutionsBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#solutionsBtn').attr("src").replace("_over.png", ".png");
                $('#solutionsBtn').attr("src", src);
            });

        $(".sf-menu #technicalNav a")
            .mouseover(function() { 
                var src = $('#technicalBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#technicalBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#technicalBtn').attr("src").replace("_over.png", ".png");
                $('#technicalBtn').attr("src", src);
            });

        $(".sf-menu #contactNav a")
            .mouseover(function() { 
                var src = $('#contactBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#contactBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#contactBtn').attr("src").replace("_over.png", ".png");
                $('#contactBtn').attr("src", src);
            });

        $(".sf-menu #partnerNav a")
            .mouseover(function() { 
                var src = $('#partnerBtn').attr("src").match(/[^\.]+/) + "_over.png";
                $('#partnerBtn').attr("src", src);
            })
            .mouseout(function() {
                var src = $('#partnerBtn').attr("src").replace("_over.png", ".png");
                $('#partnerBtn').attr("src", src);
            });
    });

    $(".tabs-menu a").click(function(event) {
        event.preventDefault();
        $(this).parent().addClass("current");
        $(this).parent().siblings().removeClass("current");
        var tab = $(this).attr("href");
        $(".tab-content").not(tab).css("display", "none");
        $(tab).fadeIn();
    });

    $('.tab-parent').each(function(){
        $(this).find(".tab_content").hide(); //Hide all content
        $(this).find("ul.tabs li:first").addClass("active").show(); //Activate first tab
        $(this).find(".tab_content:first").show(); //Show first tab content
    });

    //On Click Event
    $("ul.tabs li").click(function() {
        var parents = $(this).parentsUntil('.tab-parent').parent();
        $("li", parents).removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content", parents).hide(); //Hide all tab content

        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active ID content
        return false;
    });

                    jQuery('ul.sf-menu').superfish();
                });

有没有办法让这两种方法都起作用?当我这样做时,结果将不会过滤。(见此)

为什么要嵌套文档就绪调用?已经存在的javascript不是我的工作。。。这是我必须处理的问题。