-
-
Save ryanflorence/4947457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Puts a big annoying arrow in your window when you're not scrolled down, like a dummy | |
# | |
scrollAlert = $("<div style='position: fixed; z-index: 10000; bottom: -10px; left: 10px; font-size: 10em; opacity: 0.5'>⬇</div>") | |
count = $("<div style='position: fixed; z-index: 10000; bottom: -50px; left: 50px; color: #fff'></div>") | |
lineCount = 0 | |
showing = false | |
body = $ document.body | |
win = $ window | |
doc = $ document | |
show = -> | |
return if showing | |
scrollAlert.appendTo(body).fadeIn() | |
count.html(lineCount).appendTo(body).fadeIn() | |
showing = true | |
remove = -> | |
return unless showing | |
scrollAlert.fadeOut -> scrollAlert.remove() | |
count.fadeOut -> count.remove() | |
lineCount = 0 | |
showing = false | |
checkBottom = -> | |
atBottom = win.scrollTop() + win.height() >= doc.height() | |
if atBottom then hide() else show() | |
onNewLine = -> | |
lineCount++ | |
checkBottom() | |
$(window).scroll checkbottom | |
bind 'line', onNewLine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment