css3实现动态波纹特效,由于css3里面有过渡和动画效果,现在利用css3实现动态波浪效果就很简单了,直接使用transform来实现就ok, 使得translateX 产生偏移就可以不断实现循环动态效果,这样就比传统的flash来实现更为简单。而且对页面也比较友好的。
本文主要和大家介绍css3实现波纹特效、H5实现动态波浪效果,h5棋牌房间如何安装(q-2152876294) 现在分享一套搭建教程(http://diguaym.com) 非常不错,具有参考借鉴价值,需要的朋友可以参考下,希望能帮助到大家。
html5结构:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<p class="wrap__uc-hdinfo"> <p class="inner flexbox"> <p class="uimg"> <span class="img"><img src="images/uimg/uimg-def.jpg" /></span> </p> <a class="info flex1" href="#"> <label class="name">露娜</label> <label class="type mt-10">普通会员</label> <label class="tel ff-ar">18621535487</label> </a> <i class="arr iconfont icon-youjiantou c-fff fs-24"></i> <a class="lktel" href="tel:15888886666"><i class="iconfont icon-dianhua1"></i></a> </p> <!--css3实现波纹--> <p class="wrap__uc-waves"> <i class="wave w1"></i> <i class="wave w2"></i> </p> </p> |
css3代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/*css3波纹*/ .wrap__uc-waves{overflow:hidden;height:1rem;width:100%;position:absolute;bottom:0;} .wrap__uc-waves .wave{width:15rem; transform-origin:center bottom; position:absolute;left:0;bottom:0;} .wrap__uc-waves .w1{background:url(../images/icon__uc-hd-waves01.png) no-repeat;background-size:cover; height:.5rem; animation:anim_wave 5s linear infinite;} .wrap__uc-waves .w2{background:url(../images/icon__uc-hd-waves02.png) no-repeat;background-size:cover; height:.7rem; animation:anim_wave 6s linear infinite;} @keyframes anim_wave { 0% { transform: translateX(0) translateZ(0) scaleY(1) } 50% { transform: translateX(-25%) translateZ(0) scaleY(0.55) } 100% { transform: translateX(-50%) translateZ(0) scaleY(1) } } |
这几天使用H5开发了一个仿微信聊天前端界面,尤其微信底部编辑器那块处理的很好,使用html5来开发,虽说功能效果并没有微信那么全,但是也相当不错了,可以发送消息、表情,发送的消息自动回滚定位到底部,另外可以对消息、图片、视频有不同的右键处理提示,还有打赏、占屏等操作。
html代码片段:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<!--BEGIN 打赏--> <p class="js_dialog" id="J_Dialog_dashang" style="display: none;"> <!--<p class="weui-mask"></p>--> <p class="weui-dialog"> <i class="weui-xclose"></i> <p class="weui-dialog__bd"> <!-- //打赏模板区--> <p class="ws__popup-template"> <h2 class="hdTit">为喜欢的节目打赏</h2> <p class="item flexbox"> <input class="ipt-txt align-l flex1" type="text" name="dschooseProgram"placeholder="选择打赏节目" readonly /> </p> <p class="item item-area"> <textarea class="describe" name="content" placeholder="输入打赏语,30字以内(选填)"></textarea> </p> <p class="item item-gift" id="J__chooseGift"> <p class="gift flexbox selected" data-gift="001"> <label class="txt"><span>豪车</span><em class="time">霸屏50秒</em></label> <span class="amount">¥<em>12</em> <i class="chkbox"></i></span> </p> <p class="gift flexbox" data-gift="002"> <label class="txt"><span>动人玫瑰</span><em class="time">霸屏20秒</em></label> <span class="amount">¥<em>8</em> <i class="chkbox"></i></span> </p> </p> </p> </p> <p class="weui-dialog__ft"> <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" style="background: #ff4400; border-radius: 4px; color: #fff;">支付 <span>¥<em class="moneyNum">12</em></span> 打赏</a> </p> </p> </p> <!--END 打赏--> |
Javascript代码片段:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
/* ——聊天编辑器区域 */ var $editor = $(".J__editorText"), editor = $editor[0]; var $face = $(".emotion-area dd img"); $face.on("click", function(e){ if($(this).hasClass("face")){ //图像 var img = $(this)[0].cloneNode(true); editor.focus(); setTimeout(function(){ var range, node; if(document.selection && document.selection.createRange){ document.selection.createRange().pasteHTML(img); }else if(window.getSelection && window.getSelection().getRangeAt){ range = window.getSelection().getRangeAt(0); range.insertNode(img); range.collapse(false); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } }, 16); }else if($(this).hasClass("del")){ //删除 editor.focus(); range = window.getSelection().getRangeAt(0); range.collapse(false); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); document.execCommand("delete"); } }); //...格式化编辑器包含标签 editor.addEventListener("focus", function(evt) { surrounds() }, true); editor.addEventListener("input", function(evt) { surrounds(); }, false); function surrounds() { setTimeout(function () { //chrome var sel = window.getSelection(); var anchorNode = sel.anchorNode; if (!anchorNode) return; if (sel.anchorNode === editor || (sel.anchorNode.nodeType === 3 && sel.anchorNode.parentNode === editor)) { var range = sel.getRangeAt(0); var p = document.createElement("p"); range.surroundContents(p); range.selectNodeContents(p); range.insertNode(document.createElement("br")); //chrome sel.collapse(p, 0); (function clearBr() { var elems = [].slice.call(editor.children); for (var i = 0, len = elems.length; i < len; i++) { var el = elems[i]; if (el.tagName.toLowerCase() == "br") { editor.removeChild(el); } } elems.length = 0; })(); } }, 0); } //...滚动到聊天内容底部 function scrollToBottom(){ $(‘.ws__chatMsg-panel‘).animate({scrollTop: $("#J__chatMsgList").height()}, 300); } |