Guest User

Untitled

a guest
Apr 26th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // because I just needed the function to run once, then assign it -
  2. // I knew that I'd never need to run it manually again, so here I
  3. // extended the Function prototype :)
  4.  
  5. Function.prototype.runReturn = function (scope) {
  6. this.call(scope);
  7. return this;
  8. };
  9.  
  10. // for example:
  11. $(document).on('orientationchange', function () {
  12. $('body').removeClass('portrait landscape').addClass(window.innerWidth < window.innerHeight ? 'portrait' : 'landscape');
  13. }.runReturn());
Add Comment
Please, Sign In to add comment