Jquery 当另一个div';s边距等于0px
基本上,我有一个div,当单击右箭头或左箭头时,它会水平移动。使用以下jQuery:Jquery 当另一个div';s边距等于0px,jquery,html,Jquery,Html,基本上,我有一个div,当单击右箭头或左箭头时,它会水平移动。使用以下jQuery: $(".arrow_right").click(function(){ $(".movingdiv").animate({marginLeft: '+=-225px'}, 500); }); $(".arrowcontainer_left").click(function(){ $(".movingdiv").animate({marginLeft: '+=225px'}, 500); }); 为了确保移动
$(".arrow_right").click(function(){
$(".movingdiv").animate({marginLeft: '+=-225px'}, 500);
});
$(".arrowcontainer_left").click(function(){
$(".movingdiv").animate({marginLeft: '+=225px'}, 500);
});
为了确保移动div不会离开屏幕,我希望左箭头的css更改为:
visibility:hidden;
当移动div的左边距等于0px时。当移动div的左边距等于675px(或三次单击)时,右箭头也是如此
任何帮助都将不胜感激 像这样做
$(".arrowcontainer_left").click(function(){
$(".movingdiv").animate({marginLeft: '+=225px'}, 500,function() {
if($(".movingdiv").css("margin-left") == "675px")
{ // your stuff to hide
}
});
});
可能是这样:-免责声明:我写的。检查回拨功能中的左边距。我认为您在左边距+/-中犯了错误。你应该在你做过的地方做左边距+和-。