jquery - javascript if something has css attribute of value -
i execute animation when page loads when css attribute has value of something. animation works fine without if statement. here code:
$(document).ready(function() { if($("h1").css('font-size') == '36px'){ $("h1").animate({ "font-size" : "20px" }, 750); } });
from comments op, appear stray rule in stylesheet has caused font-size set other expected.
the way determine can done browser's dom inspector. generally, can right click element, hit inspect (or it) , see value being set.
here more specific how-to's using these:
chrome - https://developers.google.com/chrome-developer-tools/docs/elements
firefox - https://developer.mozilla.org/en-us/docs/dom_inspector/introduction_to_dom_inspector
internet explorer - http://msdn.microsoft.com/library/gg589507(vs.85).aspx
Comments
Post a Comment