firefox event.preventDefault(); 没有效果的解决方案

 $('.sub-list-click a').click(function (event) {
        event.preventDefault();
        var sub = $(this).parent("li").next(".sub, .homepage-sub");

        if (sub.css('display') == 'none') {
            $(".sub, .homepage-sub").slideUp();
            $(".sub, .homepage-sub").children("li").animate({
                opacity: "0"
            }, 10);

            setTimeout(function () {
                sub.slideDown();
            }, 200);
            setTimeout(function () {
                sub.children("li").animate({
                    opacity: "1"
                }, 200);
            }, 500);

        } else {
            sub.slideUp();
        }
    });
说明function中的event参数必须加,如果没有firefox 中会报没有event这个参数的异常, 但是在chrome中不会有这种问题。
原文地址:https://www.cnblogs.com/ly-radiata/p/6667486.html