Skip to content

Conversation

@tubaxenor
Copy link

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

Add window re-size and scroll events to adjust the offset of calender.
@ded
Copy link
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants