I am a beginner when it comes to jQuery and CSS, and I am attempting to animate two DIVs with the class .iDoElement using the following JQuery code:
$( '.iDoElement' ).each(function () {
var randomDelay = Math.floor(Math.random() * 600);
$(this).delay(randomDelay).animate ({width:0}, 1000);
});
However, both divs have padding-right and padding-left defined, which prevents them from reducing their width to zero. I have read that the width of a div affects its content and does not take into account the padding.
What is the best solution to this issue? Is animating padding-left and padding-right to zero the only option?
Thank you in advance.