jquery - window.resize not working as reloading the resized window -


here piece of jquery loading href link window resized less 767, working fine, disappear want hide , show want see, click on reload button of browser puts webpage same should not on window width of below 767.

not working refresh resized web page.

$(window).bind('resize', function(e){      width = $(window).width();      if (width < 767){         $("a.collapselistbt").show();         // here         if ($('.content-box-right').hasclass('show')){             $('.content-box-right').removeclass('show');         }      } else{         $("a.collapselistbt").hide();         $('.content-box-right').addclass('show');     }  }); 

please suggest how keep still , not let move setting fixed window width of 767

add javascript

$(document).load(function(e){      width = $(window).width();      if (width < 767){         $("a.collapselistbt").show();         // here         if ($('.content-box-right').hasclass('show')){             $('.content-box-right').removeclass('show');         }      } else{         $("a.collapselistbt").hide();         $('.content-box-right').addclass('show');     }  }); 

your problem function called on window.resize, therefore when load page there nothing job want to. more on use css , media queries that, in opinion far better.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -