Last active
September 9, 2018 02:34
-
-
Save luislobo14rap/f2e48d0562b79f787f90e04ff44625da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// resizeExpert.js v1.0.1 | |
function resizeExpert(sizesToRun = [0, 99999], f_on = function() {}, f_off = function() {}) { | |
if (typeof sizesToRun[0] == 'object') { | |
for (let i = 0; i < sizesToRun.length; i++) { | |
resizeExpert(f_on, sizesToRun[i]); | |
}; | |
} else { | |
$(window).on('resize', function() { | |
if (self.outerWidth >= sizesToRun[0] && self.outerWidth <= sizesToRun[1]) { | |
f_on(); | |
} else { | |
f_off(); | |
}; | |
}); | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// resizeExpert.min.js v1.0.1 | |
function resizeExpert(a=[0,99999],b=function(){},c=function(){}){if('object'==typeof a[0])for(let d=0;d<a.length;d++)resizeExpert(b,a[d]);else $(window).on('resize',function(){self.outerWidth>=a[0]&&self.outerWidth<=a[1]?b():c()})} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment