我使用了一些非常简单的.toggleClass()函数,动画为1 second.Everything,除了动画之外,效果都很好。我觉得这真的很有趣。
看看我的fiddle!
$(function(){
$('#main_button').click(function(){
$('#one, #two, #three, #four').toggleClass("width", 1000);
return false;
});
});发布于 2013-06-19 06:09:22
JQuery UI扩展了toggleClass以允许动画,但默认的JQuery .toogleClass()不会动画。您需要在您的小提琴中包含JQuery UI。
发布于 2013-06-19 06:08:28
$(function(){
$('#main_button').click(function(){
$('#one, #two, #three, #four').animate({'width' :'toggle'}, 1000);
return false;
});
});发布于 2018-03-24 17:54:52
$(function(){
$('#main_button').click(function(){
$('#one, #two, #three, #four').slideToggle({'width' :'toggle'},
1000);
return false;
});
});https://stackoverflow.com/questions/17179840
复制相似问题