My code is this:
我的代码是这样的:
jQuery('.cart-module .cart-heading').bind('click', function() {
if (jQuery(this).hasClass('active')) {
jQuery(this).removeClass('active');
} else {
jQuery(this).addClass('active');
}
jQuery(this).parent().find('.cart-content').slideToggle('slow');
});
//--></script>
You can test it for yourself by quickly adding a product to your cart like this https://muddydogcoffee.com/teas/176-organic-crimson-berry-fruit-tisane?device=iphone and going to the shopping cart here https://muddydogcoffee.com/shopping-cart.
您可以通过向您的购物车快速添加产品进行测试,比如https://muddydogcoffee.com/teas/176-organic-crimson-berry-fruit-tisane?设备=iphone,进入购物车这里https://muddydogcoffee.com/shoppingcart。
When you click "Estimate Shipping & Taxes," it should display the DIV underneath of it. However, it only works in Chrome and not in Firefox. What can I do to fix this?
当您单击“预估运费和税金”时,它应该显示下面的DIV。不过,它只适用于Chrome,不适用于Firefox。我该怎么做才能解决这个问题呢?
Thanks.
谢谢。
3 个解决方案
#1
3
I had the same problem before, I haven't really understood why it happens but I found a workaround for it.
我以前也遇到过同样的问题,我不明白为什么会发生这种情况,但我找到了解决办法。
I am not sure if it will also work for you but what I did is I removed the display:none in the stylesheet and just added it inline in the html.
我不确定它是否也适用于您,但我所做的是删除了显示:没有在样式表中,只是在html中添加了它。
If anyone could explain the strange behavior it will really be helpful though.
如果有人能解释这种奇怪的行为,那将会很有帮助。
#2
2
Add event.preventDefault();
and event.stopPropagation();
for this to work in all browsers including Firefox. See Snippet below:
添加event.preventDefault();和event.stopPropagation();这在所有浏览器中都适用,包括Firefox。请参见下面的代码片段:
jQuery('.cart-module .cart-heading').bind('click', function(e) {
e.preventDefault();
e.stopPropagation();
if (jQuery(this).hasClass('active')) {
jQuery(this).removeClass('active');
} else {
jQuery(this).addClass('active');
}
jQuery(this).parent().find('.cart-content').slideToggle('slow');
});
#3
0
Have you tried :
你有试过:
$(document).ready(function() {
// put all your jQuery goodness in here.
});
#1
3
I had the same problem before, I haven't really understood why it happens but I found a workaround for it.
我以前也遇到过同样的问题,我不明白为什么会发生这种情况,但我找到了解决办法。
I am not sure if it will also work for you but what I did is I removed the display:none in the stylesheet and just added it inline in the html.
我不确定它是否也适用于您,但我所做的是删除了显示:没有在样式表中,只是在html中添加了它。
If anyone could explain the strange behavior it will really be helpful though.
如果有人能解释这种奇怪的行为,那将会很有帮助。
#2
2
Add event.preventDefault();
and event.stopPropagation();
for this to work in all browsers including Firefox. See Snippet below:
添加event.preventDefault();和event.stopPropagation();这在所有浏览器中都适用,包括Firefox。请参见下面的代码片段:
jQuery('.cart-module .cart-heading').bind('click', function(e) {
e.preventDefault();
e.stopPropagation();
if (jQuery(this).hasClass('active')) {
jQuery(this).removeClass('active');
} else {
jQuery(this).addClass('active');
}
jQuery(this).parent().find('.cart-content').slideToggle('slow');
});
#3
0
Have you tried :
你有试过:
$(document).ready(function() {
// put all your jQuery goodness in here.
});