Javascript resize background color proportionally to its own size -


i want resize background image 30% original size use background element. sure mistake somewhere in last line. here code :

var img = new image(); img.src = "wallpaper.jpg"; var = img.height; var newwidth = (img.width*0.3)); var newheight = (img.height*0.3));  t.getbody().style.backgroundimage = "url("+img.src+")";  t.getbody().style.backgroundsize = "(newwidth)px  (newheight)px"; 

values of background-size property should xpx ypx. try change last line this:

t.getbody().style.backgroundsize = newwidth+"px "+newheight+"px"; 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -