jQuery学习笔记8——多行文本框高度变化

 1 <! DOCTYPE html PUBLIC  " -//W3C//DTD XHTML 1.0 Transitional//EN "   " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
 2 < html xmlns = " http://www.w3.org/1999/xhtml " >
 3 < head >
 4 < meta http - equiv = " Content-Type "  content = " text/html; charset=utf-8 "   />
 5 < title > 多行文本框高度变化 </ title >
 6 < script type = " text/javascript "  src = " jquery-1.2.6.min.js " ></ script >
 7 < script type = " text/javascript " >
 8 ExpandedBlockStart.gifContractedBlock.gif    $(document).ready(function() {
 9        var $comment = $("#comment");//获取评论框
10ExpandedSubBlockStart.gifContractedSubBlock.gif        $(".bigger").click(function(){//判断是否处于动画
11ExpandedSubBlockStart.gifContractedSubBlock.gif            if(!$comment.is(":animated")){
12ExpandedSubBlockStart.gifContractedSubBlock.gif                if($comment.height()<500){
13ExpandedSubBlockStart.gifContractedSubBlock.gif                $comment.animate({height:"+=50"},400);
14                }
            
15            }
            
16        }
);//“放大”按钮绑定单击事件
17ExpandedSubBlockStart.gifContractedSubBlock.gif        $(".small").click(function(){//判断是否处于动画
18ExpandedSubBlockStart.gifContractedSubBlock.gif            if(!$comment.is(":animated")){
19ExpandedSubBlockStart.gifContractedSubBlock.gif                if($comment.height()>50){
20ExpandedSubBlockStart.gifContractedSubBlock.gif                $comment.animate({height:"-=50"},400)
21                }
    
22            }
            
23        }
);//"缩小"按钮绑定单击事件
24    }
)    
25 </ script >
26 < style type = " text/css " >
27 ExpandedBlockStart.gifContractedBlock.gif.msg_caption span { background:#ccc; display:inline-block; width:60px; text-align:center; height:28px; line-height:28px; cursor:pointer;}
28 </ style >
29 </ head >
30 < body >
31 < form >
32 < div  class = " msg " >
33      < div  class = " msg_caption " >
34          < span  class = " bigger " > 放大 </ span >
35          < span  class = " small " > 缩小 </ span >
36      </ div >
37      < div >
38          < textarea id = " comment "  rows = " 8 "  cols = " 20 " >
39             多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框多行文本框高度变化,多行文本框高度变化,多行文本框
40          </ textarea >
41      </ div >
42 </ div >
43 </ form >
44 </ body >
45 </ html >

转载于:https://www.cnblogs.com/guopei/articles/1523575.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值