Skip to content

Instantly share code, notes, and snippets.

@anneallen
Created June 11, 2014 19:04
Show Gist options
  • Save anneallen/d13a202d29743c37614e to your computer and use it in GitHub Desktop.
Save anneallen/d13a202d29743c37614e to your computer and use it in GitHub Desktop.
Jquery for screen width and height
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