五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

h5趣聊|仿微信群聊html5|h5仿微信語音/紅包

2020-04-23 10:04 作者:xiaoyan2019  | 我要投稿

前些時間有使用html5開發(fā)過微直播項目,當(dāng)時里面有聊天模塊部分,這次就重新抽離出聊天模塊,開發(fā)了這個h5趣聊項目,功能效果比較類似微信聊天界面。

基于html5+css3+Zepto+swiper+wcPop+flex等技術(shù)混合開發(fā),實(shí)現(xiàn)了發(fā)送消息、表情(動圖),圖片、視頻預(yù)覽,添加好友/群聊,右鍵長按菜單。新增了語音模塊、地圖定位模塊。


項目中點(diǎn)擊的時候有Material波紋效果,利用js實(shí)現(xiàn)的插件,另外彈窗部分使用wcPop插件

wcRipple({ elem: '.effect__ripple-fff', opacity: .15, speed: .5, bgColor: "#fff" });

wcRipple({ elem: '.effect__ripple', opacity: .15, speed: .5, bgColor: "#000" });


搖一搖模塊使用的是shake.js插件實(shí)現(xiàn)功能

var _shake = new Shake({threshold: 15});

_shake.start();

window.addEventListener("shake", function(){

? ? ?window.navigator.vibrate && navigator.vibrate(500);

? ? ?//搖一搖邏輯部分...

}


// >>> 【搖一搖加好友核心模塊】------------------------------------------

// 搖一搖加好友彈窗

$("#J__popScreen_shake").on("click", function () {

? ? var shakePopIdx = wcPop({

? ? ? ? id: 'wcim_shake_fullscreen',

? ? ? ? skin: 'fullscreen',

? ? ? ? title: '搖一搖',

? ? ? ? content: $("#J__popupTmpl-shakeFriends").html(),

? ? ? ? position: 'right',

? ? ? ? xclose: true,

? ? ? ? style: 'background: #303030;',

? ? ? ? show: function(){

? ? ? ? ? ? // 搖一搖功能

? ? ? ? ? ? var _shake = new Shake({threshold: 15});

? ? ? ? ? ? _shake.start();

? ? ? ? ? ? window.addEventListener("shake", function(){

? ? ? ? ? ? ? ? window.navigator.vibrate && navigator.vibrate(500);

? ? ? ? ? ? ? ? // console.log("觸發(fā)搖一搖!");

? ? ? ? ? ? ? ? $(".J__shakeInfoBox").html("");

? ? ? ? ? ? ? ? $(".J__shakeLoading").fadeIn(300);

? ? ? ? ? ? ? ? // 消息模板

? ? ? ? ? ? ? ? var shakeTpl = ...

? ? ? ? ? ? ? ? setTimeout(function(){

? ? ? ? ? ? ? ? ? ? $(".J__shakeLoading").fadeOut(300);

? ? ? ? ? ? ? ? ? ? $(".J__shakeInfoBox").html(shakeTpl);

? ? ? ? ? ? ? ? }, 1500);

? ? ? ? ? ? }, false);

? ? ? ? }

? ? });

});

另外按住語音效果則是使用touchstart、touchend等原生事件實(shí)現(xiàn)

// >>> 【按住說話核心模塊】------------------------------------------

// ...按住說話

var _voiceObj = $(".J__wdtVoice"), eY1 = 0, eY2 = 0, eY3 = 0, isDrag = true;

var voiceIdx;

var difftime = 0;

function initVoice(){

? ? _voiceObj.on("touchstart", function(e){

? ? ? ? difftime = new Date();

? ? ? ? if(!isDrag) return;

? ? ? ? isDrag = false;

? ? ? ? eY1 = e.originalEvent.targetTouches[0].pageY;

? ? ? ? _voiceObj.text("松開 結(jié)束");

? ? ? ? // 彈窗提示

? ? ? ? voiceIdx = wcPop({

? ? ? ? ? ? id: 'wdtVoice',

? ? ? ? ? ? skin: 'toast',

? ? ? ? ? ? content: '<div style="margin-top:-10px;"><i class="iconfont icon-yuyin" style="font-size:65px;"></i><div style="line-height:32px;">手指上滑,取消發(fā)送</div></div>',

? ? ? ? ? ? style: 'border-radius:6px;height: 160px; width:160px;',

? ? ? ? ? ? time: 10,

? ? ? ? ? ? opacity: 0,

? ? ? ? });

? ? ? ? _voiceObj.on("touchmove", function (e) {

? ? ? ? ? ? e.preventDefault();

? ? ? ? ? ? eY3 = e.originalEvent.targetTouches[0].pageY;

? ? ? ? ? ? if(eY1 - eY3 < 150){

? ? ? ? ? ? ? ? _voiceObj.text("松開 結(jié)束");

? ? ? ? ? ? }else{

? ? ? ? ? ? ? ? _voiceObj.text("松開手指,取消發(fā)送");

? ? ? ? ? ? ? ? // 彈窗提示

? ? ? ? ? ? ? ? $("#wdtVoice .popui__panel-cnt").html('<div style="margin-top:-10px;"><i class="iconfont icon-quxiao" style="font-size:65px;"></i><div style="background:#c53838; border-radius:3px; line-height:32px;">松開手指,取消發(fā)送</div></div>');

? ? ? ? ? ? }

? ? ? ? });

? ? });

? ? _voiceObj.on("touchend", function (e) {

? ? ? ? e.preventDefault();

? ? ? ? eY2 = e.originalEvent.changedTouches[0].pageY;

? ? ? ? _voiceObj.text("按住 說話");

? ? ? ? // 錄音時間太短提示

? ? ? ? if(new Date() - difftime < 1000){

? ? ? ? ? ? // 彈窗提示

? ? ? ? ? ? $("#wdtVoice .popui__panel-cnt").html('<div style="margin-top:-10px;"><i class="iconfont icon-gantan" style="font-size:65px;"></i><div style="line-height:32px;">錄音時間太短!</div></div>');

? ? ? ? } else{

? ? ? ? ? ? if (eY1 - eY2 < 150) {

? ? ? ? ? ? ? ? // 發(fā)送成功

? ? ? ? ? ? ? ? submitData();

? ? ? ? ? ? ? ? console.log("測試數(shù)據(jù)");

? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? // 取消發(fā)送

? ? ? ? ? ? ? ? console.log("cancel");

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? // 關(guān)閉彈窗

? ? ? ? setTimeout(function(){

? ? ? ? ? ? wcPop.close(voiceIdx);

? ? ? ? }, 500);

? ? ? ? isDrag = true;

? ? });

}

由于不能粘貼過多代碼,只能作些上述簡單介紹了,希望大家會喜歡!


h5趣聊|仿微信群聊html5|h5仿微信語音/紅包的評論 (共 條)

分享到微博請遵守國家法律
聂荣县| 依安县| 龙江县| 临安市| 修水县| 南陵县| 涞水县| 宁明县| 胶南市| 交城县| 比如县| 酉阳| 平和县| 炉霍县| 朔州市| 平罗县| 嫩江县| 萨嘎县| 陆河县| 旬阳县| 江陵县| 宁都县| 湖北省| 凉城县| 中山市| 西乡县| 新沂市| 临潭县| 孝昌县| 莎车县| 靖安县| 平顺县| 新乡市| 桃源县| 揭阳市| 鹤峰县| 诸暨市| 广东省| 鞍山市| 都兰县| 阳东县|