簡體   English   中英

無法最大化或切換聊天框,自動滾動不起作用

[英]can't maximize or toggle chatbox, autoscroll not working

我的聊天框不會最大化,自動滾動或返回到底部進行新輸入。 還有,有什么方法可以使彈出式頭像充當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');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM