页面里我先写了个死的div定死了高度是20px并写了overflow: hidden,因为不写这个定了20px没用,东西多了还是直接就撑破了,里边的内容就不一定了,用户自己输入的,点击按钮的时候伸长到内容的底部,再点按钮再收回来到20px,怎么实现啊jquery
我的HTML代码 <div id="dvtypelist" class="fei_lei" style="height:20px;overflow: hidden;">
<ul>
<li>线路分类:</li>
<asp:Repeater ID="rptypelist" runat="server">
<ItemTemplate>
<li><a href="#"><%#Eval("t_name")%></a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
<div class="r pt5">
<a id="adow" href="javascript:Tourtypelistdow()"><img src="http://img.henghengw.com/img/Consult_hh/arrow1.gif" /></a>
<a id="atop" href="javascript:Tourtypelisttop()" style="display:none"><img src="http://img.henghengw.com/img/Consult_hh/arrow2.gif" /></a>
</div>
<div style="clear: both;">
</div>
</div>
我写的JQfunction Tourtypelistdow() {
$("#dvtypelist").animate({ height: '100px' }, 1000);
$("#adow").hide();
$("#atop").show();
}
function Tourtypelisttop() {
$("#dvtypelist").animate({ height: '20px' }, 1000);
$("#atop").hide();
$("#adow").show();
}那个高度怎么能是内容的高度额??求帮忙
我的HTML代码 <div id="dvtypelist" class="fei_lei" style="height:20px;overflow: hidden;">
<ul>
<li>线路分类:</li>
<asp:Repeater ID="rptypelist" runat="server">
<ItemTemplate>
<li><a href="#"><%#Eval("t_name")%></a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
<div class="r pt5">
<a id="adow" href="javascript:Tourtypelistdow()"><img src="http://img.henghengw.com/img/Consult_hh/arrow1.gif" /></a>
<a id="atop" href="javascript:Tourtypelisttop()" style="display:none"><img src="http://img.henghengw.com/img/Consult_hh/arrow2.gif" /></a>
</div>
<div style="clear: both;">
</div>
</div>
我写的JQfunction Tourtypelistdow() {
$("#dvtypelist").animate({ height: '100px' }, 1000);
$("#adow").hide();
$("#atop").show();
}
function Tourtypelisttop() {
$("#dvtypelist").animate({ height: '20px' }, 1000);
$("#atop").hide();
$("#adow").show();
}那个高度怎么能是内容的高度额??求帮忙
解决方案 »
- 分别建立二个DataTable,然后建立DataRelation,最后根据关联再产生DataTable(如何做)
- 用wmrm sdk开发drm系统 如何让用户定制权限
- 文件上传时遇到鬼魅,来人中......100%超难,不信的进
- 简单问题:Application_Error
- webapplication是不是不能穿过防火墙和局域网?
- 求ASP.NET博客源码
- Jquery对数据进行分类汇总求和
- 各位谁有aspnetmenu1.04的正式版本!!!给小弟一个
- 求救!!!我的水晶报表为什么连接不上我的数据库
- treeview如何做到点击节点名(不是+/-)展开/收缩节点下的内容?
- 如何在FormView中设置日期显示格式?
- log4net在页面调用时报错
只需要取element的offsetHight即可.
$("#dvtypelist").animate({ height: 'auto' }, 1000);
$("#adow").hide();
$("#atop").show();
// $("#dvtypelist").toggle(function() { $("#dvtypelist").css({ height: "100px" }); }, function() { $("#dvtypelist").css({ height: "20px" }); })
}
$("#dvtypelist").element.offsetHight();?
这样么
IE 7\ 8\ FF 定义CSS min-height:20px;, 大于20了会自动撑开.##dvtypelist
{
min-height:20px;
*height:20px;
}