kenny kenny - 2 months ago 12
CSS Question

slideToggle has a rubber band effect on my ul slideToggle (jQuery help)

My mobile menu has a jquery function of slideToggle when the window browser is smaller than

600p
x. However, when the icon is clicked it slides down the
ul
, but immediately slides it back up.

Here's what I'm talking about

https://jsfiddle.net/0cc4dynv/

Answer

Just comment or delete this line:

$(this).toggleClass('.trigger-expand').css('display', '');

Now if you want to change some css when the browser size is changing and is larger than 600px use this method:

$(window).on('resize', function(){
      var win = $(this); //this = window
      if (win.width() > 600) { 
         /* The window is larger than 600px 
            change you css style here */ 
      }
});