Skip to content

Instantly share code, notes, and snippets.

@anthonybrown
Forked from zwily/downscroller.coffee
Created May 25, 2019 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonybrown/dd666d0727d43110a19ae0ce9d645073 to your computer and use it in GitHub Desktop.
Save anthonybrown/dd666d0727d43110a19ae0ce9d645073 to your computer and use it in GitHub Desktop.
Puts a big annoying arrow in your Limechat window when you're not scrolled down, like a dummy. (requires limescripts)
## Puts a big annoying arrow in your window when you're not scrolled down, like a dummy
#
scrollAlert = $("<div id='scrolldown-arrow'>⬇</div>")
showing = false
body = $ document.body
win = $ window
doc = $ document
style = $ """
<style type='text/css'>
@-webkit-keyframes bounce {
30% {
-webkit-transform: translateY(3%) scale(1.05, 1);
}
}
#scrolldown-arrow {
display: none;
position: fixed;
z-index: 10000;
bottom: -10px;
left: 10px;
font-size: 10em;
opacity: 0.5;
-webkit-animation-name: bounce;
-webkit-animation-duration: 1000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-out;
</style>
"""
$(document.getElementsByTagName("head")[0]).append(style)
show = ->
return if showing
scrollAlert.appendTo(body).fadeIn()
showing = true
remove = ->
return unless showing
scrollAlert.fadeOut -> scrollAlert.remove()
showing = false
checkBottom = ->
atBottom = win.scrollTop() + win.height() >= doc.height()
if atBottom then remove() else show()
$(window).scroll checkBottom
bind 'line', checkBottom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment