CalEnder icon indicating copy to clipboard operation
CalEnder copied to clipboard

add window re-size and scroll events

Open tubaxenor opened this issue 12 years ago • 1 comments

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

tubaxenor avatar Apr 26 '13 02:04 tubaxenor

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) {
  // ...
}))

ded avatar Apr 26 '13 16:04 ded