简体   繁体   English

jQuery响应式下拉菜单问题

[英]JQuery responsive drop down menu issue

I have a responsive drop down jquery menu. 我有一个响应下拉jquery菜单。 For some reason I removed a duplicated jquery library, because it was conflicting with WooCommerce and after that the drop-down responsive menu is not working. 由于某种原因,我删除了重复的jquery库,因为它与WooCommerce冲突,此后下拉响应菜单不起作用。

Here is a link to my web site: https://www.santa-film.eu/ 这是指向我的网站的链接: https : //www.santa-film.eu/

As you can see If you click on toggle icon, menu is not showing. 如您所见,如果单击切换图标,则不会显示菜单。 here is the jQuery script used: 这是使用的jQuery脚本:

jQuery.fn.noSelect = function() {
    var o = "none";
    return this.bind("selectstart dragstart mousedown", function() {
        return !1
    }).css({
        MozUserSelect: o,
        msUserSelect: o,
        webkitUserSelect: o,
        userSelect: o
    })
};
var ias = $.ias({
    container: ".items",
    item: ".item",
    pagination: ".navigation",
    next: ".nav-previous a"
});
ias.extension(new IASSpinnerExtension), $(document).ready(function() {
    $(".dod").click(function() {
        var o = $(this).attr("id");
        1 == o ? ($(".menus").hide(), $(this).attr("id", "0")) : ($(".menus").show(), $(this).attr("id", "1"))
    }), $(".menus").mouseup(function() {
        return !1
    }), $(".dod").mouseup(function() {
        return !1
    }), $(document).mouseup(function() {
        $(".menus").hide(), $(".dod").attr("id", "")
    })
}), $(document).ready(function() {
    $(".rclic").click(function() {
        var o = $(this).attr("id");
        1 == o ? ($(".rmenus").hide(), $(this).attr("id", "0")) : ($(".rmenus").show(), $(this).attr("id", "1"))
    }), $(".rmenus").mouseup(function() {
        return !1
    }), $(".rclic").mouseup(function() {
        return !1
    }), $(document).mouseup(function() {
        $(".rmenus").hide(), $(".rclic").attr("id", "")
    })
}), $(document).ready(function() {
    $(".report").click(function() {
        var o = $(this).attr("id");
        1 == o ? ($(".reportform").hide(), $(this).attr("id", "0")) : ($(".reportform").show(), $(this).attr("id", "1"))
    }), $(".reportform").mouseup(function() {
        return !1
    }), $(".report").mouseup(function() {
        return !1
    }), $(document).mouseup(function() {
        $(".reportform").hide(), $(".report").attr("id", "")
    })
}), $(document).ready(function() {
    $(".buscaboton").click(function() {
        var o = $(this).attr("id");
        1 == o ? ($(".buscaformulario").hide(), $(this).attr("id", "0")) : ($(".buscaformulario").show(), $(this).attr("id", "1"))
    }), $(".buscaformulario").mouseup(function() {
        return !1
    }), $(".buscaboton").mouseup(function() {
        return !1
    }), $(document).mouseup(function() {
        $(".buscaformulario").hide(), $(".buscaboton").attr("id", "")
    })
}), $(document).ready(function() {
    $(".rclic2").click(function() {
        var o = $(this).attr("id");
        1 == o ? ($(".rbuscar").hide(), $(this).attr("id", "0")) : ($(".rbuscar").show(), $(this).attr("id", "1"))
    }), $(".rbuscar").mouseup(function() {
        return !1
    }), $(".rclic2").mouseup(function() {
        return !1
    }), $(document).mouseup(function() {
        $(".rbuscar").hide(), $(".rclic2").attr("id", "")
    })
});

So is there a way to get that drop down work correctly? 那么有没有办法使下拉菜单正确工作?

Thanks 谢谢

I search a lot in Internet and I found a solution for conflicting Jquery in wordpress and theme. 我在Internet上进行了大量搜索,发现了一种解决Wordpress和主题冲突的Jquery的解决方案。

So I removed Jquery tag from my header and I used This code to avoid any conflict between my javascript and jquery: 因此,我从标头中删除了Jquery标记,并使用了以下代码来避免我的javascript和jquery之间发生任何冲突:

jQuery.noConflict();

(function( $ ) {

   // Paste your Code Here...

})( jQuery );

like This: 像这样:

jQuery.noConflict();
(function( $ ) {
$(document).ready(function() {
$(".rclic").click(function() {
    var o = $(this).attr("id");
    1 == o ? ($(".rmenus").hide(), $(this).attr("id", "0")) : ($(".rmenus").show(), $(this).attr("id", "1"))
}), $(".rmenus").mouseup(function() {
    return !1
}), $(".rclic").mouseup(function() {
    return !1
}), $(document).mouseup(function() {
    $(".rmenus").hide(), $(".rclic").attr("id", "")
})
}), $(document).ready(function() {
$(".report").click(function() {
    var o = $(this).attr("id");
    1 == o ? ($(".reportform").hide(), $(this).attr("id", "0")) : ($(".reportform").show(), $(this).attr("id", "1"))
}), $(".reportform").mouseup(function() {
    return !1
}), $(".report").mouseup(function() {
    return !1
}), $(document).mouseup(function() {
    $(".reportform").hide(), $(".report").attr("id", "")
})
}), $(document).ready(function() {
$(".buscaboton").click(function() {
    var o = $(this).attr("id");
    1 == o ? ($(".buscaformulario").hide(), $(this).attr("id", "0")) : ($(".buscaformulario").show(), $(this).attr("id", "1"))
}), $(".buscaformulario").mouseup(function() {
    return !1
}), $(".buscaboton").mouseup(function() {
    return !1
}), $(document).mouseup(function() {
    $(".buscaformulario").hide(), $(".buscaboton").attr("id", "")
})
}), $(document).ready(function() {
$(".rclic2").click(function() {
    var o = $(this).attr("id");
    1 == o ? ($(".rbuscar").hide(), $(this).attr("id", "0")) : ($(".rbuscar").show(), $(this).attr("id", "1"))
}), $(".rbuscar").mouseup(function() {
    return !1
}), $(".rclic2").mouseup(function() {
    return !1
}), $(document).mouseup(function() {
    $(".rbuscar").hide(), $(".rclic2").attr("id", "")
})
});
})( jQuery );

I share this solution to help other people may have this problem. 我分享此解决方案以帮助其他人可能遇到此问题。

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

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