我的聊天框不会最大化,自动滚动或返回到底部进行新输入。还有,有什么方法可以使弹出式头像充当android facebook Messenger应用程序,并具有onclick功能来最小化和最大化?任何帮助在这里将不胜感激。提前致谢。

    <html>
    <head>
    <title>chatbox</title>
    <style>
    .popup-wrap {
        top: 100px;
        cursor: pointer;
        width: 80px;
        height: 110px;
        position: fixed;
        right: 40px;
    }
    .popup-avatar {
        top: 11px;
        left: 11px;
        background: url(../images/ella1.jpg);
        position: absolute;
        height: 78px;
        width: 78px;
        padding: 0px 0px 0px 0px;
        margin: 0px 0px 0px 0px;
        border-radius:45px 45px 45px 45px
    }
    .shell-1 {
        right: 20px;
        background: #583983;
        height: 80px;
        width: 80px;
        padding: 5px;
        margin: 5px;
        -moz-border-radius:25px 25px 25px 25px;
        border-radius:45px 45px 45px 45px
    }
    .shell-2 {
        background: white;
        height: 78px;
        width: 78px;
        padding: 0px 0px 2px 2px;
        margin: 0px;
        -moz-border-radius:25px 25px 25px 25px;
        border-radius:45px 45px 45px 45px
    }
    .tinyBanner {
        background: #583983;
        color: white;
        height: 24px;
        width: 100px;
        display: inline-block;
        text-align: center;
        padding-top:5px;
        border-radius: 15px 0px 15px 0px;
    }
    .msgbox_wrap {
        background:white;
        width:250px;
        height:400px;
        position:fixed;
        right:20px;
        padding:2px 2px 2px 2px;
        bottom:0px;
        display: none;
        border: 1px solid #b0b0b0;
        border-radius:10px 10px 0px 0px;
    }
    .msgbox_wrap-on {
        display: block !important;
    }
    .msg_head{
        cursor:pointer;
        background:#583983;
        padding:15px;
        color:white;
        bottom:0px;
        border-radius:10px 10px 0px 0px;
    }
    .close{
        float:right;
        color:white;
    }
    .msg_wrap{
        background:url(../images/m3-act.jpg);
        min-width:250px;
        height:355px
    }
    .chatlog {
      height:300px;
    }
    .botMessage {
        background-color: #ffffff;
        position: relative;
        padding: 5px;
        margin: 5px;
        display: inline-block;
        -moz-border-radius:10px 10px 10px 10px;
        border-radius:10px 10px 10px 10px;
    }

    .userMessage {
        background-color:#583983;
        position: relative;
        color: #FFF;
        padding: 5px;
        margin: 5px;
        display: inline-block;
        float: right;
        -moz-border-radius:10px 10px 10px 10px;
        border-radius:10px 10px 10px 10px;
    }


    .convo {
        height: 290px;
        padding: 5px;
        border-style: solid;
        border-width: 1px;
        border-color: #eeeeee;
    }

    .scroll {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .msg_input {
        background:#583983;
        height: 42px;
        padding: 5px;
        border-style: solid;
        border-width: 1px;
        border-color: #eeeeee;
    }
    </style>
    </head>
    <body>
    <div class="popup-wrap">
      <a href="#" id="addClass">
      <div class="shell-1">
        <div class="shell-2">
          <div class="popup-avatar"></div>
        </div>
      </div>
      </a>
      <div class="tinyBanner">Talk to Ella</div>
    </div>
         <div class="msgbox_wrap" id="qnimate">
            <div class="msg_head">Talk to Ella
                <div class="close">X</div>
            </div>
            <div class="msg_wrap">
                <div class="convo scroll">
              <div id="chatlog"></div>
            </div>
    <div class="msg_input">
             <form method="post" name="talkform" id="talkform" action="index.php">
                <form id="talkform" class="talkform">
                    <input id="say" name="say" placeholder="You say...." type="text"   style="background:  #white; height: 41px; width: 237px; font-color: #B1B1B1; font-size: 14px; font-weight: 400;  border-radius:5px 5px 5px 5px;">
                </form>
            </form>
            </div>
        </div>
        </div>
       <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
    // This minimize and close
$(document).ready(function(){
        $('.msg_head').click(function(){
        $('.msgbox_wrap').animate({height:45},'slow');
});
    $('.close').click(function(){
        $('.msgbox_wrap').hide();
    });
});


</script>

<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
    //popup chat fromm avatar icon
$(document).ready(function(){
$("#addClass").click(function () {
          $('#qnimate').addClass('msgbox_wrap-on');
            });
  });
 </script>

<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
//This autoscrolls
    setInterval(function(){
        $('.msg_wrap').load('convo scroll');
        $('#chatlog').animate({scrollTop: $('msg_wrap')[0]}, 1000);
    });
</script>
    </body>
    </html>

最佳答案

您的代码中没有任何内容可以使聊天框恢复到完整的高度。您将其设置为45px,并且从不执​​行任何其他操作。

$('.msgbox_wrap').animate({height:200},'slow');

09-25 18:12