希望你一切都好。下面是我目前的jquery代码--只是向上移动div (而不是向下移动):
$("#thedacbutton").click(function(){
$(".thedacALLCONTENT").animate({"top":"-=558px"}, 400, 'linear');
});
我希望"thedacALLCONTENT“在单击"thedacbutton”时向上移动,并在再次单击(向下)时移回原来的位置。就像触发器一样。非常感谢你的帮助,谢谢-汤姆
发布于 2012-04-21 01:02:18
我不是百分之百确定..你在用这些非常少的细节做什么。但是你可以试着这样做
var flag = true;
$("#thedacbutton").click(function(){
if(flag){
$(".thedacALLCONTENT").animate({"top":"-=558px"}, 400, 'linear');
flag = false;
}else{
$(".thedacALLCONTENT").animate({"top":"+=558px"}, 400, 'linear');
flag = true;
}
});
发布于 2012-04-21 01:05:38
使用slideToggle()怎么样?
$("#thedacbutton").click(function(){
$(".thedacALLCONTENT").slideToggle();
});
Quick 。
https://stackoverflow.com/questions/10250392
复制相似问题