Skip to content

add window re-size and scroll events #12

Open
wants to merge 1 commit into from

2 participants

@tubaxenor

Add window re-size and scroll events to adjust the offset of calender.

@tubaxenor tubaxenor add window re-size and scroll events
Add window re-size and scroll events to adjust the offset of calender.
2dc7110
@ded
Owner
ded commented Apr 26, 2013

this is going to be a little intense without throttling. perhaps adding the following would help

function throttle(wait, fn, opt_scope) {
  var timeout
  return function () {
    var context = opt_scope || this
      , args = arguments
    if (!timeout) {
      timeout = setTimeout(function () {
          fn.apply(context, args)
          timeout = null
        },
        wait
      )
    }
  }
}

$(window).on('scroll resize', throttle(100, function (e) {
  // ...
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.