Created
June 11, 2014 19:04
-
-
Save anneallen/d13a202d29743c37614e to your computer and use it in GitHub Desktop.
Jquery for screen width and height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function ($) { | |
$(document).ready(function(e) { | |
showViewportSize(); | |
}); | |
$(window).resize(function(e) { | |
var windowsize = $(window).height(); | |
$(".home-bottom").toggleClass("tiny",(windowsize < 780)); | |
showViewportSize(); | |
}).trigger('resize') | |
; | |
function showViewportSize() { | |
var the_width = $(window).width(); | |
var the_height = $(window).height(); | |
$('#width').text(the_width); | |
$('#height').text(the_height); | |
} | |
/* You can safely use $ in this code block to reference jQuery */ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment