1

I have a simple jQuery slidetoggle activated on button click. I notice on Google Chrome on a HTC One M8 (Probably Chrome issue on Android in general) the opened or 'toggled' div will automatically close when I stop scrolling. Is this some kind of a feature or a bug?

 var jq = jQuery;

//Page resize hide & show
jq(window).resize(function() {
var width = jq(window).width();
    newWidth = jq(window).width();
    if ( newWidth >= 980 ) {
        // Do something
    } else {
        // Do something
    };
});
Paul Redmond
  • 3,276
  • 4
  • 32
  • 52

1 Answers1

1

This issue actually stems from the Mobile Chrome resize event fires on scroll. My own solution is below:

var jq = jQuery;

jq(window).load(function(){
   widthHorz = jq(window).width();
});

//Page resize hide & show
jq(window).resize(function() {
    if ( widthHorz != jq(window).width() ) {
        var newWidth = jq(window).width();
        if ( newWidth >= 980 ) {
            // Do something
        } else {
            // Do something
        };
    };
});
Community
  • 1
  • 1
Paul Redmond
  • 3,276
  • 4
  • 32
  • 52