jQuery $(window).resize(); equivalent event listener, that only fires on a specified axis change?
You can save the width of the browser on a window load in variable. Example:
var w = 0;
$( window ).load( function(){
w = $( window ).width();
});
$( window ).resize( function(){
if( w != $( window ).width() ){
//Do something
w = $( window ).width();
}
});
How about using like this?
var w = $(window).width();
$(window).resize(function(){
if ($(window).width()==w) return;
w = $(window).width();
// ... your code
});