2016-10-03 129 views
0

我有一個響應下拉jquery菜單。出於某種原因,我刪除了一個重複的jquery庫,因爲它與WooCommerce相沖突,之後下拉響應菜單不起作用。JQuery響應下拉菜單問題

這裏是我的網站的鏈接:https://www.santa-film.eu/

正如你可以看到,如果你切換圖標點擊,菜單沒有顯示。 這裏使用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", "") 
    }) 
}); 

那麼,有沒有辦法讓下拉正常工作?

感謝

+0

您可以使用CSS創建在懸停時打開的懸停菜單。但是你不能創建依賴於'onclick()'的菜單來在沒有javascript的情況下運行。爲什麼要刪除jQuery?正如LoicTheAztec所說,你需要提供更多信息。 – helgatheviking

回答

0

我搜索了很多在網上,我發現了一個解決方案,用於WordPress和主題衝突的jQuery的。

所以,我從我的頭取出Jquery的標籤,我用這個代碼,避免我的JavaScript和jQuery之間的任何衝突:

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); 

我同意這個解決方案,以幫助:

 
jQuery.noConflict(); 

(function($) { 

    // Paste your Code Here... 

})(jQuery); 

喜歡這個其他人可能有這個問題。