I think you could make the whole thing pretty simply. Rather than creating a
separate handler (with each()) for each .help element, you could wrap the
entire thing in one "on" handler, which you would not need to customize per
page or worry about dom:loaded or anything:
document.on('click', '.help', function(evt, elm){
var tip = elm.down('div');
new Ajax.Updater(tip, 'path/to/help', {
parameters: {id: elm.id},
onCreate: function(){
tip.addClassName('loading');
},
onSuccess: function(){
tip.removeClassName('loading');
tip.addClassName('tooltip');
}
});
});
document.on('click', '.tooltip', function(evt, elm){
evt.stop();
elm.update().removeClassName('tooltip');
});
That's expecting a structure like this:
<div class="help" id="widget_1"><div></div></div>
You could use some other construction if you like, but that would do the trick.
The rest will be creating the CSS for the tooltip, and the Web service to fill
it in.
If you didn't want to get the Ajax thing going, you could also just put the
tooltip in the help element itself, maybe in a data-attribute. That depends on
how much content there would be. It would be completely instantaneous.
Walter
On May 30, 2013, at 2:24 PM, Phil Petree wrote:
> I'll play around with it on Sunday and see what I can cobble together... of
> course it looks like you did most of the work in 5 minutes and I'll spend
> most of the day playing around with it! LOL
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.