javascript - I want to define a css stylesheet or add a body class dependant on viewport size -


i have wordpress website wish provide content via iframe on facebook..

without using wordpress plugin, know if provide function in jquery says if viewport equal 520px either load css file or add body class..

also, if viewport = 520px hide element..

i think can done after lot of searching, cannot seem find definative answer..

if can help, appreciate it..

kindest regards,

danny

for css, use media queries, eg:

<link href="bigscreen.css" media="screen , (min-device-width: 520px)" rel="stylesheet"> 

note ie 6, 7, , 8 don't support this, ie use:

<!--[if lt ie 9]> <link href="megafubarbrowser.css" media="screen" rel="stylesheet"> <![endif]--> 


for js, use code like:

if (screen.width <= 520) {     $('.bigstuff').hide (); } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -