Add CSS based on window height

octwedns

New Member
I have a pop up window that looks great so long as the viewer is using a large screen (over 750px high) I'd like to add a css selector to push up the important content (and obscure the title and intro info which is expendable) for people viewing on laptops. I thought the easiest way would be to raise the body tag up -180 px. I thought it would be a good job for my first shot at jquery but I can't seem to get it to work...I've tried\[code\]if($(window).height() <= 650) $(body).css("margin-top","-180px");\[/code\]and also \[code\]$(document).ready(function() { if ($(window).height() < 670) { $("body").css('margin-top', '-180px'); } else { $("body").css('margin-top', '0px'); }});?\[/code\]neither seems to work, any help would be greatly appreciated
 
Back
Top