Skip to content

Instantly share code, notes, and snippets.

@andyjeffries
Created November 19, 2009 12:22
Show Gist options
  • Select an option

  • Save andyjeffries/238729 to your computer and use it in GitHub Desktop.

Select an option

Save andyjeffries/238729 to your computer and use it in GitHub Desktop.
FDJ = {}
FDJ.EventScroller = {
init: function() {
setTimeout(function() {
FDJ.EventScroller.start_all();
}, 3000);
console.log("Setting timeout - done");
},
start_all: function() {
$(".wrapper").each(function() {
FDJ.EventScroller.start($(this));
});
},
start: function(elem) {
console.log("Starting on ", elem);
elem.scrollTo('max', {"axis":"x", "duration":3000, "onAfter":function() {
console.log("Finished scrolling, returning", $(this))
setTimeout(function() {
FDJ.EventScroller.back($(this))
}, 3000);
}});
},
back: function(elem) {
console.log("Going back on ", elem);
elem.scrollTo(0, {"axis":"x", "duration":3000, "onAfter":function() {
FDJ.EventScroller.start($(this));
}});
}
}
$(function(){
FDJ.EventScroller.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment