scrollIt.js icon indicating copy to clipboard operation
scrollIt.js copied to clipboard

Conditional loading of script based on screen height/width.

Open klummy opened this issue 11 years ago • 1 comments

Great work on scrollIt.

However, is it possible to conditionally load the script based on browser height/width? My design goes to hell at height = 550px & below and I would like to load the script for heights greater than that. Something like this:

However, as you may have guessed, my JS skills are pretty poor & I can't get this to work. You may also take a look at the site - ouroja.com - for a demonstration.

Thanks.

klummy avatar Apr 23 '14 18:04 klummy

$(function () {
    $(window).resize(function () {
        if ( $(window).width() > 550 ) {  // run the code

// ScrollIt
$(function(){
  $.scrollIt({
  easing: 'linear',      // the easing function for animation
  scrollTime: 600,       // how long (in ms) the animation takes
  activeClass: 'active', // class given to the active nav element
});
});

        }
    }).resize(); //call resize function 
});

markdieselcore avatar Jan 13 '16 16:01 markdieselcore