Creating animations with jQuery
<script>
$(document).ready(function(){
$("button").click(function(){
$("h2").animate({backgroundColor: '#00f', width: '50%', marginLeft: '50px'});
});
});
</script>
Writing HTML code
<h2>This is a heading</h2>
<p style="background: #ff0">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
During my exploration of jQuery, I noticed that using CSS property margin-left
as marginLeft
in my test worked fine. However, the property backgroundColor
did not work as expected. Am I correct in my understanding or am I missing something important?