Skip to content

Instantly share code, notes, and snippets.

@devigned
Created February 19, 2011 23:29
Show Gist options
  • Save devigned/835499 to your computer and use it in GitHub Desktop.
Save devigned/835499 to your computer and use it in GitHub Desktop.
var PageTransitioner = Class.create();
PageTransitioner.prototype = {
initialize: function() {
this.trackLinks();
},
trackLinks: function() {
document.observe('click', (function(event){
var target = event.findElement('a[rel^=transition]') || event.findElement('area[rel^=transition]');
if (target) {
if (typeof(target) != 'object') target = $(target);
target.path = target.href;
target.href='#';
new Effect.Puff('content', {
duration :1.0,
afterFinish:function() {
window.location = target.path;
return false;
}});
}
}).bind(this));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment