Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to make a autoscrolling/carousel like function for an unordered list of images.

When you mouse over the containing div its calling a function that's job is to animate the margin on the <ul>

$(".thumbs").animate({"margin-top": (currentMargin - 10) + "px"}, function(){
     console.log("margin-top" + (currentMargin - 10) + "px");
     running=false;
     });

I'm seeing the correct value for what I want in the log ie the animation thinks its finished... but nothing is changing on my div.

Does anyone have any insight as to what might make the animate function not work as intended?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
374 views
Welcome To Ask or Share your Answers For Others

1 Answer

try using "marginTop" instead of "margin-top". Normally when you use the CSS props as "border-something" or "margin-something" is better to use the "normalized" version of it, as you used to do it in DHTML (styles.marginTop).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...