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
Post a Comment