顾陌 发布时间:2014-09-23 分类:Web 阅读:5306次 添加评论
常常在手机等网站上面看到的“查看更多”按钮JS代码:
<script type="text/javascript">
var txtHeight=0;
var oneHeight=500;
$(document).ready(function(){
debugger;
txtHeight=$("#ems_text_info").height();
if(txtHeight>oneHeight)
{
$("#ems_text_info").height(oneHeight);
}
});
function moreclick()
{
var h=$("#ems_text_info").height();
if((h+oneHeight)>=txtHeight)
{
$("#ems_text_info").height(txtHeight);
}
else
{
$("#ems_text_info").height(h+500);
}
}
</script>按钮点击事件调用moreclick事件。
发表评论:
◎欢迎您的参与讨论。