Can anyone help me convert something from Prototype to jquery?
I am beginning to learn jquery but I have one piece of prototype that I am having a hard time recoding to jquery. It is basically a flash message for a regular flash message and ajax requests to the server. Thanks!
- /*---------------------------------------------------------------
Setup Flash Messages UI
----------------------------------------------------------------*/
document.observe('dom:loaded', function() {
Flash.setup();
});
/*---------------------------------------------------------------
Flash message
----------------------------------------------------------------*/
var Flash = {
setup: function() {
this.responders();
if ($('flash')) {
new Effect.Appear('flash', { duration: 0.5, queue: { position: 'front', scope: 'flash', limit: 1 },
afterFinish: function(effect) {
new Effect.DropOut('flash', { delay: 2.0, duration: 0.3, queue: { position: 'end', scope: 'flash', limit: 1 } });
}
});
}
},
responders: function() {
Ajax.Responders.register({
onCreate: function() {
new Effect.Appear('ajax-request', { duration: 0.5, queue: { position: 'front', scope: 'request' } });
},
onComplete: function() {
if (Ajax.activeRequestCount == 0) {
new Effect.Fade('ajax-request', { duration: 0.3, queue: { position: 'end', scope: 'request' } });
}
}
});
}
}