jquery - window resize function only one time for specific window size -
hi need if window less 768px alert , if window more 768px alert some, have script , else if(){} not work when window size more 768px p.s. need heppend when window less 768px or more 768px
var = 0; $(window).resize(function(){ if(width < 768 && == 0){ alert('less 768px'); i++; alert(i); }else if(width > 768){ alert('more 768px'); i==0; } });
instead of i==0; should i=0; inside else if() because assigning value 0 i.
although don't know why using i complete code should :-
var = 0; $(window).resize(function(){ if(width < 768 && == 0){ alert('less 768px'); = 1; }else if(width > 768 && == 1){ alert('more 768px'); = 0; } });
Comments
Post a Comment