javascript - Setting background-position with jQuery -
i have span
tag let's #span
id has property background: url(some image) -22px top no-repeat
, wich displays image background. if has property background: url(some image) -22px top no-repeat
, image displayed. problem if specify ('#span').attr('background-position','0px top')
nothing happens, other image not displayed. explain why ?
use .css()
$('#span').css('background-position','0px top');
.css() -> value of style properties first element in set of matched elements.
Comments
Post a Comment