gpt4 book ai didi

jQuery 购物车悬停 objective-c ss 类

转载 作者:太空宇宙 更新时间:2023-11-04 12:08:31 24 4
gpt4 key购买 nike

我目前正在建立一个电子商务网站,在这里可以找到 http://www.trade-tools.com .在标题的右侧,我有一个购物车按钮,其中包含购物车中的数量和商品。当我将鼠标悬停在购物车上时,弹出窗口应该会显示购物车中的元素,如下所示 http://demo2.woothemes.com/storefront/ .我无法让它工作。我在我的脚本中将 jQuery 作为“jQuery”而不是“$”,因为我正在通过 Wordpress 运行它。我相信我没有用 jQuery 正确定位我的 css 类,但我无法弄清楚。有人知道我在这里做错了什么吗?提前致谢!

jQuery('.cart-parent').hover(function () {        
jQuery('.widget_shopping_cart').slideDown(500);
return false;
});
jQuery('.widget_shopping_cart').mouseleave(function () {
jQuery(this).slideUp(500);
return false;
});
.cart-tab .cart-parent {
position:relative;
}
.cart-tab .widget_shopping_cart {
position: absolute;
left: 0;
width: 100%;
display: none;
z-index: 999999;
}
<div class="right cart-tab light visible">
<a class="cart-parent">
<span class="amount">$0.00</span>
<span class="contents">0 items</span>
</a>
<div class="widget woocommerce widget_shopping_cart">
<div class="widget_shopping_cart_content">
<ul class="cart_list product_list_widget">
<li class="empty">There are no products in your cart.</li>
</ul>
</div>
</div>
</div>

最佳答案

这里不需要 javascript,你可以纯粹用 CSS 来完成....在你的 css 中添加以下行:

`.cart-tab:hover .widget_shopping_cart { 显示: block ;

.购物车标签{ position:relative;}`

不要在代码前后包含`,不知道为什么让我添加它。

我试过检查 View ,所以它应该可以工作。如果不是,请尝试确保 css 的位置低于任何可能从默认主题样式覆盖它的位置。

关于jQuery 购物车悬停 objective-c ss 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29199850/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com