Javascript for geting window size.

JavaScript
voted: 1
vote
media queries window resize

This code check if window have certain size, depend on window size. I've applied bootstrap media queries size. Get windows size on resize.

$(window).resize(function(){
   var width = $(window).width();
   if(width > 1199){
// window wider than 1999px
   console.log("width > 1200", width > 1200, width)
	}
//1st breakpoint
	if(width >= 992 && width <= 1199){  

		//If width of window is less or equal 1199 and is not grater or equal than 992 display console log		
		console.log("width >= 992 && width <= 1199",width >= 992 && width <= 1199, width)
		
	}		
//2nd breakpoint 
	if(width >= 768 && width  <= 991){   

		//If width of window is less or equal 991 and is not grater or equal than 768 display console log
		console.log("width >= 768 && width  <= 991",width >= 768 && width  <= 991, width)				
				
	}
//3rd breakpoint 	
	if(width  <= 767){	
	
		//If width of window is less or equal 767 display console log
		console.log("width >= 768 && width  <= 991",width >= 768 && width  <= 991, width)				
			
	}
});
working url: not entered
version: not entered
Leave a Comment:
Characters left:
No comments yet.