All the things you list are very easy with LowPro. I will provide some
psuedo-code / aircoded.
1. Mouseover an image
// options ''hovered'' : ''path/to/image''
HoverImage = Behavior.create({
initialize : function(options) {
this.options = options || {};
this.options.idle = this.element.src;
},
onmouseover : function(e) {
this.element.src = this.options.hovered;
},
onmouseout : function(e) {
this.element.src = this.options.idle;
}
})
Use:
Event.addBehavior({
''#img1'' : HoverImage({ hovered :
"/images/somepic.png" })
})
2. Link to Remote (Request)
HTML:
= link_to "caption", some_action_url, :class =>
"remote-request"
JS:
Event.addBehavior({
''.remote-request'' : Remote.Link
})
3. Link to Remote (update a div)
HTML:
= link_to "caption", some_action_url, :class =>
"remote-update"
JS:
Event.addBehavior({
''.remote-request'' : Remote.Link({ "update" :
"some_div_to_update" })
})
Or you can even do complex remote links with stuff happening before and
after:
HTML:
= link_to "Delete", delete_something_url, :id =>
"delete_link"
JS:
DeleteRemoteItem = Remote.Link({
onLoading : function() {
$(''someid'').doSomething();
},
onComplete : function(e) {
$(''someid'').doSomething();
}
})
Event.addBehavior({
''#delete_link'' : DeleteRemoteItem
})
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---