javascript - 表 (.animate) 的 Jquery 问题

标签 javascript jquery

我想要为我的网站添加一个最小化表格按钮,所以我只是在摆弄一些 Jquery,我想知道为什么在单击该按钮后(并且它减小了其大小) 它会恢复到默认大小吗? -.animate 完成后?

http://zombiewrath.com/maintest2.php

-在那里尝试一下,

代码:

<html>
<head>
<style type="text/css">
#tablemin { 
  height:inherit;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<input type="button" value="Click Here" onClick="dostuff();">
<div id="tablemin">
<table bordercolor="#0000FF" width="670" border="1">
        <tr>
          <td class="style5" width="400" valign="top" style="width: 300px"><b><u>Personal Feed: </u></b><br>
          </td>
          <td class="style5" width="355" valign="top"><u><strong>Live Feed:</strong> </u><br>
              <div id="ReloadTime3" style="width: 350px">  
</div></td>
        </tr>
        <tr>
          <td class="style5" valign="top" colspan="3" style="width: 488px"><b><u>Local news for Zone B-4...</u></b></td></tr>
      </table>
</div>
<script type="text/javascript">
function dostuff() {
$("#tablemin").animate({ 
    //opacity: "0.4",
    height: "50px"
    }, 1000 );

}
//$(document.body).click(function () {
//$('#tablemin').animate({height:'1px'}, 'slow');
//$('#tablemin').fadeOut(1);
//}); 
</script>
Hi
</body></html>

非常感谢

最佳答案

why after the button is clicked (and it reduced its size) it grows back to the default size?

使用您当前的代码,执行此操作,

<style type="text/css">
#tablemin { 
  height:inherit;
  overflow: hidden;
}
</style>

关于javascript - 表 (.animate) 的 Jquery 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4163252/

相关文章:

javascript - Angular,比较 2 个对象并替换(可能连接?)

javascript - 我的第一个基于 jQuery 的 slider 需要一些错误处理

javascript - Grunt 添加多个输入/输出目录

javascript - 如何为指定的java代码打开新窗口

javascript - Mapbox 标记符号颜色变化

javascript - 访问 $http 中的 'Set-Cookies' header

c# - 带有 C# 的 jQuery 不会触发 onclick 事件

jquery - 在 mvc4 中调用从 View 中删除帖子?

javascript - jQuery : Click event & Switching between "active" elements 问题

javascript - 使用 React.JS 预填充表单