Advertisement
Guest User

JQUERY WINDOW RESIZE FUNCTIONALITY USAGE

a guest
Jan 19th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. $(document).ready(function(){
  3.  
  4. var $window = $(window);
  5.        
  6. function checkWidth() {
  7.  
  8. var windowsize = $window.width();
  9.  
  10. if (windowsize < 768) {
  11. //do work for < 768
  12. }
  13. else{
  14. //do work for other size greater then 768
  15. }
  16. }
  17. //initialize for first time check
  18. checkWidth();
  19.  
  20. //now check on window resize
  21. $(window).resize(checkWidth);  
  22.  
  23.  
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement