• 表单-放大缩小


    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
    span{
    background: #ccc;
    cursor: pointer;
    }
    .comment{
    max-height: 500px;
    min-height: 50px;
    height: 100px;

    }
    </style>
    </head>
    <body>
    <form >
    <div class="msg">
    <div class="msg_caption">
    <span class="bigger">放大</span>
    <span class="smaller">缩小</span>
    </div>
    <div><textarea id="comment" cols="30" rows="10">
    多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化
    多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化
    多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化多行文本框高度变化
    </textarea></div>
    </div>
    </form>

    </body>
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script>
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    // var $comment=$("#comment");
    // $(".bigger").click(function(){
    // if($($comment.height()<500)){
    // $comment.height($comment.height()+50);
    // }
    // });
    // $(".smaller").click(function(){
    // if($comment.height()>50){
    // $comment.height($comment.height()-50)
    // }
    // })
    // var $comment=$("#comment");
    // $(".bigger").click(function(){
    // if($($comment.height()<500)){
    // $comment.animate({height:"+=50"},400);
    // }
    // });
    // $(".smaller").click(function(){
    // if($comment.height()>50){
    // $comment.animate({height:"-=50"},400)
    // }
    // })
    var $comment=$("#comment");
    $(".bigger").click(function(){
    if(!$comment.is(':animated')){
    if($($comment.height()<500)){
    $comment.animate({scrollTop:"+=50"},400);
    }
    }

    });
    $(".smaller").click(function(){
    if(!$comment.is(':animated')){
    if($comment.height()>50){
    $comment.animate({scrollTop:"-=50"},400)
    }
    }
    })
    })
    </script>
    </html>

  • 相关阅读:
    ural 1519 fomular 1 既插头DP学习笔记
    2016集训测试赛(十九)Problem C: 无聊的字符串
    2016集训测试赛(十九)Problem A: 24点大师
    2016集训测试赛(二十)Problem B: 字典树
    写一个addEventListener以及removeEventListener
    关于props的注意事项!
    swiper轮播始终居中active图片
    vue中登录模块的插件封装
    v-show
    v-if
  • 原文地址:https://www.cnblogs.com/jinsuo/p/7420676.html
Copyright © 2020-2023  润新知