This is my code (see fiddle here):
$('div').on('click', function () {
$('.well')
.stop()
.animate({
height: "toggle",
opacity: "toggle"
});
});
I have a bootstrap .well with stuff below. Notice the discontinuity at the start and the end of the animation by looking at the stuff below.
How can I avoid these animation discontinuities?
check this out http://jsfiddle.net/dLVWr/1/:
html:
js:
The problem with your code is that the
welldiv has both text-height and padding. When toggling opacity and height, first, the content height is zeroes, that the padding. that’s what makes that jump.To avoid this make sure that the div you apply the
.animateto has no margins/paddings.