我希望使用 jQuery 覆盖 css !important
属性。不要告诉我 $('div').css("cssText", "display: none !important;");
我知道它可以工作,但当它消失时我需要一些转换。我刚刚 Handlebars 放在fiddle上在这里我可以更清楚地表达我的观点。
jQuery
$('div').click(function(){
$('div').fadeOut('slow').css("cssText", "display: none !important;");
});
最佳答案
您可以在动画之后使用 animate()
,然后使用 .remove()
。看看 fiddle - http://jsfiddle.net/8gavv7n2/2/
$('div').click(function(){
$('div').animate({opacity: 0}, 500, function(){
$(this).remove()
});
});
您还需要包含 jQueryUI。
关于jquery - 如何使用带有过渡的 jQuery 来覆盖 css !important 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26035351/