HTML5高仿手机微信闲聊、手机微信闲聊小表情

2020-10-10 10:08 jianzhan

以前做过1版h5手机微信闲聊挪动端,这段時间闲来无事就梳理了下以前新项目,又再次在本来的那版基本升高级了下,如是就有了如今的h5仿手机微信闲聊高仿版,新增了微聊、通信录、探寻、我4个控制模块 上下触碰滑屏切换,闲聊网页页面提升了多图预览、视頻播发,长按菜单UI,闲聊底部编写赏识新提升梳理(新增多小表情),弹窗则用到了自身开发设计的wcPop.js,实际看新项目实际效果图吧!

html编码片断:

<!-- //微聊底部作用面板 -->
<div class="wc__footTool-panel">
    <!-- 键入框控制模块 -->
    <div class="wc__editor-panel wc__borT flexbox">
        <div class="wrap-editor flex1"><div class="editor J__wcEditor" contenteditable="true"></div></div>
        <i class="btn btn-emotion"></i>
        <i class="btn btn-choose"></i>
        <button class="btn-submit J__wchatSubmit">推送</button>
    </div>

    <!-- 小表情、挑选控制模块 -->
    <div class="wc__choose-panel wc__borT" style="display: none;">
        <!-- 小表情地区 -->
        <div class="wrap-emotion" style="display: none;">
            <div class="emotion__cells flexbox flex__direction-column">
                <div class="emotion__cells-swiper flex1" id="J__swiperEmotion">
                    <div class="swiper-container">
                        <div class="swiper-wrapper"></div>
                        <div class="pagination-emotion"></div>
                    </div>
                </div>
                <div class="emotion__cells-footer" id="J__emotionFootTab">
                    <ul class="clearfix">
                        <li class="swiperTmpl cur" tmpl="swiper__tmpl-emotion01"><img src="img/emotion/face01/face-lbl.png" alt=""></li>
                        <li class="swiperTmpl" tmpl="swiper__tmpl-emotion02"><img src="img/emotion/face02/face-lbl.gif" alt=""></li>
                        <li class="swiperTmpl" tmpl="swiper__tmpl-emotion03"><img src="img/emotion/face03/face-lbl.gif" alt=""></li>
                        <li class="swiperTmpl" tmpl="swiper__tmpl-emotion04"><img src="img/emotion/face04/face-lbl.gif" alt=""></li>
                        <li class="swiperTmpl" tmpl="swiper__tmpl-emotion05"><img src="img/emotion/face05/face-lbl.gif" alt=""></li>
                        <li class="swiperTmpl" tmpl="swiper__tmpl-emotion06"><img src="img/emotion/face06/face-lbl.gif" alt=""></li>
                        <li class="swiperTmplSet"><img src="img/wchat/icon__emotion-set.png" alt=""></li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 挑选地区 -->
        <div class="wrap-choose" style="display: none;">
            <div class="choose__cells">
                <ul class="clearfix">
                    <li><a class="J__wchatZp" href="javascript:;"><span class="img"><img src="img/wchat/icon__choose-zp.png" /><input type="file" accept="image/*" /></span><em>相片</em></a></li>
                    <li><a class="J__wchatSp" href="javascript:;"><span class="img"><img src="img/wchat/icon__choose-sp.png" /><input type="file" accept="video/*" /></span><em>视頻</em></a></li>
                    <li><a class="J__wchatHb" href="javascript:;"><span class="img"><img src="img/wchat/icon__choose-hb.png" /></span><em>红包</em></a></li>
                    <li><a class="J__wchatSc" href="javascript:;"><span class="img"><img src="img/wchat/icon__choose-sc.png" /></span><em>我的个人收藏</em></a></li>
                    <li><a class="J__wchatWj" href="javascript:;"><span class="img"><img src="img/wchat/icon__choose-wj.png" /></span><em>文档</em></a></li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="wc__choosePanel-tmpl">
    <!-- //红包模版.begin -->
    <div id="J__popupTmpl-Hongbao" style="display:none;">
        <div class="wc__popupTmpl tmpl-hongbao">
            <i class="wc-xclose"></i>
            <ul class="clearfix">
                <li class="item flexbox">
                    <label class="txt">总额度</label><input class="ipt-txt flex1" type="tel" name="hbAmount" placeholder="0.00" /><em class="unit">元</em>
                </li>
                <li class="item flexbox">
                    <label class="txt">红包个数</label><input class="ipt-txt flex1" type="tel" name="hbNum" placeholder="填写个数" /><em class="unit">个</em>
                </li>
                <li class="tips">线上人数共<em class="memNum">186</em>人</li>
                <li class="item item-area">
                    <textarea class="describe" name="content" placeholder="恭贺发家致富,吉祥如意"></textarea>
                </li>
                <li class="amountTotal">¥<em class="num">0.00</em></li>
            </ul>
        </div>
    </div>
    <!-- //红包模版.end -->
</div>

Js编码片断:

// ...长按弹出菜单
$("#J__chatMsgList").on("longTap", "li .msg", function(e){
    var that = $(this), menuTpl, menuNode = $("<div class='wc__chatTapMenu animated anim-fadeIn'></div>");
    that.addClass("taped");
    that.parents("li").siblings().find(".msg").removeClass("taped");
    var isRevoke = that.parents("li").hasClass("me");
    var _revoke = isRevoke ? "<a href='#'><i class='ico i4'></i>撤回</a>" : "";
    if(that.hasClass("picture")){
        console.log("照片长按");
        menuTpl = "<div class='menu menu-picture'><a href='#'><i class='ico i1'></i>拷贝</a><a href='#'><i class='ico i2'></i>个人收藏</a><a href='#'><i class='ico i3'></i>另存为</a>"+ _revoke +"<a href='#'><i class='ico i5'></i>删掉</a></div>";
    }else if(that.hasClass("video")){
        console.log("视頻长按");
        menuTpl = "<div class='menu menu-video'><a href='#'><i class='ico i3'></i>另存为</a>" + _revoke +"<a href='#'><i class='ico i5'></i>删掉</a></div>";
    }else{
        console.log("文本长按");
        menuTpl = "<div class='menu menu-text'><a href='#'><i class='ico i1'></i>拷贝</a><a href='#'><i class='ico i2'></i>个人收藏</a>" + _revoke +"<a href='#'><i class='ico i5'></i>删掉</a></div>";
    }
    if(!$(".wc__chatTapMenu").length){
        $(".wc__chatMsg-panel").append(menuNode.html(menuTpl));
        autoPos();
    }else{
        $(".wc__chatTapMenu").hide().html(menuTpl).fadeIn(250);
        autoPos();
    }
    function autoPos(){
        console.log(that.position().top)
        var _other = that.parents("li").hasClass("others");
        $(".wc__chatTapMenu").css({
            position: "absolute",
            left: that.position().left + parseInt(that.css("marginLeft")) + (_other ? 0 : that.outerWidth() - $(".wc__chatTapMenu").outerWidth()),
            top: that.position().top - $(".wc__chatTapMenu").outerHeight() - 8
        });
    }
});

实际效果图:

总结

以上所述是网编给大伙儿详细介绍的HTML5高仿手机微信闲聊、手机微信闲聊小表情|会话框|编写器作用,期待对大伙儿有一定的协助,假如大伙儿有任何疑惑请给我留言,网编会立即回应大伙儿的。在此也十分谢谢大伙儿对脚本制作之家网站的适用!