Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Archie22is
Created July 3, 2019 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Archie22is/12b0e942c46343c79ffed4ff28be78e8 to your computer and use it in GitHub Desktop.
Save Archie22is/12b0e942c46343c79ffed4ff28be78e8 to your computer and use it in GitHub Desktop.
Handing $(window).resize() and orientation change using jQuery
window.addEventListener('resize', function () {
myFunction('resize');
});
window.addEventListener("orientationchange", function() {
myFunction('orientation');
});
function myFunction(value) {
if (value == 'resize') {
// do something
} else if (value == 'orientation') {
// do something else
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment