Guest User

Untitled

a guest
Dec 9th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # Keep track of how many times the event as been triggered versus how many times
  2. # the timer has been fired.
  3. resizeFiredTotal = 0
  4. reizeFiredCounter = 0
  5.  
  6. # Bind a resize event to the window
  7. $(window).on 'resize', (e) ->
  8.  
  9. # Increment the resize fired event by 1
  10. resizeFiredTotal += 1
  11.  
  12. userResizing = () ->
  13.  
  14. # Check if the timer has fired more than the resize event itself.
  15. if reizeFiredCounter >= resizeFiredTotal
  16. console.log 'Do anything now that the user has stopped resizing', e if console.log?
  17. else
  18. reizeFiredCounter += 2
  19. return
  20.  
  21. # Call the userResizing every 500 milliseconds.
  22. setTimeout userResizing, 500
  23.  
  24. return
Add Comment
Please, Sign In to add comment