我使用了以前的购物车设计,但无法应用选项悬停购物车,这是一个代码示例。
我的代码
$('#cart').hover(function(e) {
$(".shopping-cart").stop(true, true).addClass("active");
}, function() {
$(".shopping-cart").stop(true, true).removeClass("active");
});
我需要在鼠标指针移出之前购物车中的内容不会消失。
代码笔示例
查看笔Shopping Cart Dropdown作者:Eduardo ( @alexd2 ) 在 CodePen .最佳答案
使用Multiple Selector将解决您的问题。
$('#cart, .shopping-cart').hover(function(e) {
$(".shopping-cart").stop(true, true).addClass("active");
}, function() {
$(".shopping-cart").stop(true, true).removeClass("active");
});
关于javascript - 带有悬停下拉菜单的购物车,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49354189/