admin管理员组文章数量:1390749
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 and going to the shopping cart here .
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?
Thanks.
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./teas/176-organic-crimson-berry-fruit-tisane?device=iphone and going to the shopping cart here https://muddydogcoffee./shopping-cart.
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?
Thanks.
Share Improve this question asked Aug 7, 2012 at 23:23 user1477388user1477388 21.5k33 gold badges151 silver badges275 bronze badges3 Answers
Reset to default 4I 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.
If anyone could explain the strange behavior it will really be helpful though.
Add event.preventDefault();
and event.stopPropagation();
for this to work in all browsers including Firefox. See Snippet below:
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');
});
Have you tried :
$(document).ready(function() {
// put all your jQuery goodness in here.
});
本文标签: javascriptjQuery SlideToggle() Not Working in FireFoxworks in ChromeStack Overflow
版权声明:本文标题:javascript - jQuery SlideToggle() Not Working in FireFox, Works in Chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744668311a2618666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论