【发布时间】:2012-03-05 22:07:44
【问题描述】:
我在表格中有一个 foreach 循环,用于动态显示数据库中的内容。
<table cellpadding="3" cellspacing="0" align="center">
<?php
foreach($test as $testcontent){
echo '<tr>';
echo '<td class="trigger">'.$testcontent[0].'</td>';
echo '<td class="trigger">'.$testcontent[1].'</td>';
echo '<td class="trigger">'.$testcontent[2].'</td>';
echo '<div id = popup style="display:none">
<div class="Month">
<div class="MonthDiv">
<span class="MonthText">'.$testcontent[0].'</span>
</div>
</div>
</div>';
echo '</tr>';
}
?>
</table>
显示/隐藏弹窗的功能如下...
$(function() {
var moveLeft = 20;
var moveDown = 10;
$('.trigger').hover(function(e) {
$('#popup').show();
//.css('top', e.pageY + moveDown)
//.css('left', e.pageX + moveLeft)
//.appendTo('body');
}, function() {
$('#popup').hide();
});
$('.trigger').mousemove(function(e) {
$("#popup").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
});
});
弹出窗口出现,但问题是当我将鼠标移到第 2、第 3 行时,弹出窗口中仅显示第一行的内容。
我不知道为什么。任何人都可以帮助我吗?
【问题讨论】:
-
为什么显示工作正常的位的代码?