javascript - How to start plugin FullPage.js when browser window is resized from mobile to tablet and up? -


using fullpage.js, disabled plugin when window size lower 767px code below. works, when resize below 767px 960px, plugin doesn't work. can restart plugin after resizing?

js: function fullpagescroll() { $('#main').fullpage({ navigation: true }); }

var $win = $(window).width();  if ( $win > 767 ) {     fullpagescroll(); } else {     fullpagescroll();     $.fn.fullpage.destroy('all'); } 

because need apply on resize event:

//first call when loading site doneresizing()  var resizeid; //calling function again  on resize can new width $(window).resize(function () {     //in order call functions when resize finished     cleartimeout(resizeid);      resizeid = settimeout(doneresizing, 500); });  //your original code function doneresizing() {     var $win = $(window).width();      if ($win > 767) {         fullpagescroll();     } else {         fullpagescroll();         $.fn.fullpage.destroy('all');     } } 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -