I'm currently working on a JavaScript animation project and I've run into some roadblocks.
One particular issue I'm facing is with animating the <label>
's margin-top
, as it's not behaving as expected.
For example:
$('label').animate({marginTop: '0%'},500);
Although the margin-top
CSS property does change, the animation occurs too quickly and lacks smooth movement.
Below is the code snippet:
HTML
<label id="menu-button-label"><input type="checkbox" id="menu-button"></label>
JavaScript:
$($('#menu-button-label').click(function() {
if($('#menu-button').is(':checked')) {
$('#menu-button-label').animate({marginTop: '0%'},500);
}
});