×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Lori DK
Added: May 9, 2017 6:19 PM
Modified: May 15, 2017 5:43 PM
Views: 26
  1. $(document).ready(function() {
  2.  
  3.     var windowSize = $(window).width();
  4.  
  5.     if (windowSize < 768) {
  6.         alert('Mobile');
  7.     }
  8.     else if (windowSize > 767 && windowSize < 1025) {
  9.         alert('Tablet');
  10.     }
  11.     else {
  12.         alert('Desktop');
  13.     }
  14.  
  15.     alert(windowSize);
  16.  
  17. });