Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Following function has the scroll event attached, which then triggers the custom event defined on line 5.
  3.  
  4. Line 5 seems to be causing the function to invoke twice (if removed line 4 is printed once, with line 5 its twice).
  5.  
  6. Custom event should only fire once, at the moment its twice.
  7. */
  8.  
  9. this.on(window, 'scroll', function (event) {
  10.   setTimeout(xxx, function() {
  11.     var win = $(window);
  12.     if ($(document).height() - win.height() === win.scrollTop()) {
  13.       console.log('testing 123');
  14.       this.trigger('uiHandlRequest', { type: 'foo' });
  15.       return false;
  16.     }
  17.   });            
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement