I am developing a complex page that contains some widgets, some drag-and-drop elements, and an interactive <canvas> timeline.
Problem:
In mouseover - on elements that can be dragged (entities) - I have to display a tooltip containing some additional information ("preview" the entity page) about this particular element.
Draggable elements (I think they are ~ 100) are represented in this way (some of them are created dynamically):
<div id="entity-1" class="draggable"> <div class="title">title</div> <img src="#URL" alt="..." /> <div class="tooltip-wrapper"></div> </div> <div id="entity-2" class="draggable"> <div class="title">title</div> <img src="#URL" alt="..." /> <div class="tooltip-wrapper"></div> </div> <div id="entity-3" class="draggable"> <div class="title">title</div> <img src="#URL" alt="..." /> <div class="tooltip-wrapper"></div> </div>
where .tooltip-wrapper initially set to display:none and opacity:0
A general tooltip is a kind of complex HTML code containing some details, i.e. (simplified batch)
<div class="tooltip-entity-wrapper"> <div class="title">entity title</div> <div class="tab"></div> <div class="tab"></div> <div class="tab"></div> <form action="..."> </form> <a href="#URL"></a> </div>
I think of three possible solutions:
- In
mouseover (on the first), execute an ajax request that returns a specific HTML tooltip, enters it inside the tooltip, shows it and hides it on mouseout . - In
mouseover (on the first), create an ajax request that returns json, draw it js (mustache), enter it inside the tooltip, show it and mouseout it on mouseout . - Display a tooltip directly inside the element and switch it to
mouseover / mouseout
Css / layout / positioning is not a big issue, also because I already created a mootools tooltip layout (if you have any suggestions about some custom mootools tooltip plugins, please let me know :)).
I just need some advice / suggestion on how to follow this embedded βhintβ or if you have the best solutions offering me. :)
Thank you all
ps I am developing a web application using rails3 (and haml, scss, compass) and mootools as a js framework (+ mustache as a template system).
stecb source share