zeus.ugent.be/content/index.coffee
2016-07-12 23:14:12 +02:00

14 lines
365 B
CoffeeScript

sticky_relocate = ->
window_top = $(window).scrollTop()
div_top = $('#sticky-anchor').offset().top
if window_top > div_top
$('#sticky').addClass('stick')
$('#sticky-anchor').height($('#sticky').outerHeight())
else
$('#sticky').removeClass('stick')
$('#sticky-anchor').height(0)
$ ->
$(window).scroll(sticky_relocate)
sticky_relocate()