Change CSS Class height and width in javascript depending on screen res

MeNe

New Member
I want the size of a div class 'content' to change depending on the size of the users' screen resolution.So far Ive written this javascript\[code\]function resize(){ if ((screen.width>1024)) { $(".content").style.width = 560 + "px"; $(".content").style.height = 315 + "px" } if ((screen.width>1280)) { $(".content").style.width = 640 + "px"; $(".content").style.height = 360 + "px" } else { $(".content").style.width = 853 + "px"; $(".content").style.height = 480 + "px" }};\[/code\]and obviously in the html I have the class '.content'why is this code not working?
 
Back
Top