我有一个内容和图像的表格,当点击时显示包含在div内的隐藏内容。这个div有另一个表格来格式化内容。现在,当我在IE和Chrome中测试这个隐藏的内容时,根据点击的按钮上下滑动。但是当我在Firefox中这样做时,内容刚刚出现并消失,没有平滑的滑动。谁能告诉我为什么。如果我将显示按钮移出顶部桌面并将其插入两张桌子之间,则上下滑动平稳运行。与此唯一的问题是我需要的显示按钮是内容中Jquery显示和隐藏在表格内
我的剧本是这样的
<script type="text/javascript">
//<![CDATA[
$(function() {
$(document).ready(function() {
$(".slidingDiv").hide()
$('.show').click(function() {
$(".slidingDiv").slideDown(1000);
return false;
});
$('.hide').click(function() {
$(".slidingDiv").slideUp(1000);
return false;
});
});
});
//]]>
</script>
出现在页面的头部
然后我的代码为
页面的身体看起来就像
<table style="width: 100%;" align="left" border="0">
<tbody>
<tr>
<td>content here</td>
<td>and here</td>
<td><a class="show"><img src="images/more.jpg" onmouseout="this.src='images/more.jpg';" onmouseover="this.src='images/more_over.jpg';" /></a></td>
</tr>
</tbody>
</table>
<div class="slidingDiv">
<table style="width: 100%;" align="left" border="0">
<tbody>
<tr>
<td>content hidden</td>
<td>content hidden</td>
<td>content hidden</td>
</tr>
<tr>
<td>content hidden</td>
<td>content hidden</td>
</tr>
<tr>
<td>content hidden</td>
<td>content hidden</td>
</tr>
</tbody>
</table>
<a class="hide"><img src="images/close.jpg" onmouseout="this.src='images/close.jpg';" onmouseover="this.src='images/close_over.jpg';" /></a>
</div>
如发现顺便说一句,$(函数(){});是$(document).ready(function(){})的简写形式; - 无需在此打包内线电话。 – ScottE