Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

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
Commits on Apr 26, 2013
  1. @tubaxenor

    add window re-size and scroll events

    tubaxenor authored
    Add window re-size and scroll events to adjust the offset of calender.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 calender.js
View
4 calender.js
@@ -175,6 +175,10 @@
calendar.$calendar.removeClass('active')
}
})
+ $(window).on('scroll resize', function(){
+ var elmOffset = $(el).offset();
+ calendar.$calendar.css({'top': elmOffset.top + el.offsetHeight, 'left':elmOffset.left});
+ })
})
}
}, true)
Something went wrong with that request. Please try again.