I am using .animate() to smoothly reposition a few divs after they’ve been made visible via .show(“slow”). Since the divs may or may not still be doing the animation, I’m also using .queue() to make sure the move takes place after the animation’s done.
Problem: .animate() doesn’t work. It gets to the right line of code, but doesn’t do anything and doesn’t generate any errors. Help?
Javascript:
function arrange_sections() {
var margin = 20;
var left = margin;
$(".section.active").queue(function() {
$(".section.active").each(function() {
$(this).animate({ "left": left }, "slow");
left += $(this).width() + margin;
});
});
}
CSS:
(I use show(“slow”) to bring the sections out of display:none)
.section {
display: none;
position: absolute;
top: 5%;
left: 5%;
padding: 20px;
z-index: 20;
}
Finally found the answer — All I needed to do was include the dequeue() function at the end of the function I passed to queue().
Thanks for your help, guys!