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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -