工具提示不适用于while循环所有图标都向我显示第一个图标的信息只有这里是php
$check = odbc_exec($conn,"select * from Item");
while($r = odbc_fetch_array($check)){
$info = $r['Info'];
$Image = $r['image'];
echo "<span class='hint'><img src='$Image'></span>
<div class='readitem' style='display:none'>$info</div>";
}
jquery:工具提示
<script type="text/javascript">
$(document).ready(function() {
var changeTooltipPosition = function(event) {
var tooltipX = event.pageX - 10;
var tooltipY = event.pageY + 10;
$('div.tooltip').css({top: tooltipY, left: tooltipX});};
var showTooltip = function(event) {
var item = $('.readitem').html();
$('<div class="tooltip"><center>'+ item + '</center></div>').appendTo('body');
changeTooltipPosition(event);
};
var hideTooltip = function() {
$('div.tooltip').remove();
};
$(".hint").bind({
mousemove : changeTooltipPosition,
mouseenter : showTooltip,
mouseleave: hideTooltip
});
});
</script>
任何解决方案?
谢谢你 ..