Advertisement
Guest User

jQuery plugin to display size of window

a guest
Mar 31st, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.fn.sizer = function(){
  2.   var y = $(window).height();
  3.   var x = $(window).width();
  4.   $('#remove').remove();
  5.   var append = '<span id="remove" style="position:fixed;bottom:15px;right:15px;background:#444;color:#ebebeb;padding:10px 15px;border-radius:1em;">';
  6.   append += x + 'px || ' + y + 'px';
  7.   append += '</span>';
  8.   $(this).append(append);
  9. }
  10.  
  11.  
  12. $(document).ready(function(){
  13.   $('body').sizer();
  14. });
  15.  
  16. $(window).on('resize', function() {
  17.   $('body').sizer();
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement