Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I cancel this script based on the size of the browser? [closed]

        $(document).ready(function(){

            var $windows = $('.window');

            $windows.windows({
                snapping: true,
                snapSpeed: 200,
                snapInterval: 800,
                onScroll: function(s){},
                onSnapComplete: function($el){},
                onWindowEnter: function($el){}
            });
        });

Hi I need to know how to disable this script based off of the browser width. So I want the snapping to be false when the browser is less than 440px.

Sorry if I haven't worded this greatly and thanks!

like image 633
user3083665 Avatar asked Dec 28 '25 23:12

user3083665


1 Answers

Replace true with a conditional that will evaluate to true or false when you want to

 $windows.windows({
            snapping: $(window).width() > 440 || $(window).height() > 440, //will be false when either dimension is less than 440, other wise it will be true
            snapSpeed: 200,
            snapInterval: 800,
            onScroll: function(s){},
            onSnapComplete: function($el){},
            onWindowEnter: function($el){}
        });
like image 185
Esaevian Avatar answered Dec 31 '25 12:12

Esaevian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!