Skip to content

Instantly share code, notes, and snippets.

@amboy00
Created December 11, 2012 14:34
Show Gist options
  • Save amboy00/4258980 to your computer and use it in GitHub Desktop.
Save amboy00/4258980 to your computer and use it in GitHub Desktop.
Easy way to show on scroll
var myDiv = dojo.byId("myID"),
thresh = 230;
dojo.style(myDiv,{ opacity: 0, display:"none" });
dojo.connect(window,"onscroll",function(e) {
var scroll = -dojo.position(dojo.body()).y;
dojo.style(myDiv, { opacity: (Math.min(Math.max(0, scroll - thresh) / thresh, 1)), display:"inline" });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment