Here is a working example which creates DHTML tooltips from ajax-loaded content. It displays loading message in the tooltip while the content is loaded, then displays the content.
Hope this helps.. TheFoot
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
div.tooltip{
position: absolute;
border: 1px solid #000000;
background-color: silver;
color: #000000;
width: 200px;
height: auto;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
var v_tooltip_timeout = 2; // Tooltip timeout in secs
var v_content_url = '24831769-load.php';
// Display a tooltip
var showTooltip = function(o_ele){
// Hide all other tooltips
$('div.tooltip').hide();
// Clone the tooltip and append it to the body element
var o_tt = $('#tooltip-template').clone().attr('id', 'tt-' + o_ele.id);
$('body').eq(0).append(o_tt);
// Store the tooltip id for easy reference
$(o_ele).attr('ttid', 'tt-' + o_ele.id);
// Position the tooltip
var a_pos = $(o_ele).position();
var a_dim = [$(o_ele).width(), $(o_ele).height()];
o_tt.css({"top": (a_pos.top + 10) + 'px', "left": (a_pos.left + 10) + 'px'});
// Display tooltip
o_tt.html('Loading...').show();
// Get content from remote url
o_tt.load(v_content_url, function(){
// Close the tooltip v_tooltip_timeout seconds after content is loaded
// Alternatives would be to show a close icon in the tooltip
setTimeout(function(){
o_tt.hide();
}, v_tooltip_timeout * 1000);
});
} // showTooltip()
// When the document is loaded..
$(document).ready(function(){
// Add hover event handler to rows
$('table tr.tooltip').hover(function(){showTooltip(this);});
});
</script>
</head>
<body>
<div id="tooltip-template" class="tooltip" style="display: none;">ADFASDFASFDGGAS</div>
<table>
<tbody>
<tr id="row-1" class="tooltip">
<td>Field 1</td>
<td>Field 2</td>
</tr>
<tr id="row-2" class="tooltip">
<td>Field 1</td>
<td>Field 2</td>
</tr>
<tr id="row-3" class="tooltip">
<td>Field 1</td>
<td>Field 2</td>
</tr>
</tbody>
</table>
</body>
</html>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85:





by: kadabaPosted on 2009-10-21 at 11:30:05ID: 25626822
a simple hover script.. not sure if it will be of much help..
Select allOpen in new window