html+css+js手机页面左右切换效果

 时间:2024-10-18 08:22:38

1、新建html文档。

html+css+js手机页面左右切换效果

2、书写hmtl代艨位雅剖码。<ul> <li> <div id=媪青怍牙"blackcover"> <h1 style="color:#F00">用鼠标单击左右滑动查看效果!</h1> <div style="text-align:center;margin:50px 0"> <p>这里是第一页</p> </div> </div> </li> <li> <h1>这里是第二页</h1> <p>这里是第二页这里是第二页这里是第二页这里是第二页</p> </li> <li> <h1>这里是第三页这里是第三页这里是第三页这里是第三页这里是第三页</h1><br /> </li> </ul>

html+css+js手机页面左右切换效果

3、书写css代码。body { margin: 0; }ul { -webkit-perspective多唉捋胝: 1000; -webkit-backface-visibility: hidden; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; margin: 0; padding: 0; position: fixed; left: 0; height: 100vh; list-style-type: none; overflow: hidden; -webkit-perspective: 1000; -webkit-backface-visibility: hidden; }li { margin: 0; padding: 0; list-style-type: none; float: left; width: 100vw; height: 100%; color: #000; text-align: center; }#blackcover { height: 100vh; width: 100vw; position: absolute; background-color: #000000; z-index: 1; color: #FFF; opacity: 0.33; display: block; }

html+css+js手机页面左右切换效果

4、书写并添加js代码。<script src="js/jquery.min.js"></script><script src="js/hammer.min.js"></script><script src="js/hammer.jquery.min.js"></script><script src="js/itemslide.min.js"></script><script src="js/sliding.js"></script>

html+css+js手机页面左右切换效果

5、书写hammer.jquery.min.js代码。<script>(function(e){if(typeof defin髫潋啜缅e==="function"&&define.amd){define(["jquery","hammerjs"],e)}else if(typeof exports==="object"){e(require("jquery"),require("hammerjs"))}else{e(jQuery,Hammer)}})(function(e,t){function n(n,r){var i=e(n);if(!i.data("hammer")){i.data("hammer",new t(i[0],r))}}e.fn.hammer=function(e){return this.each(function(){n(this,e)})};t.Manager.prototype.emit=function(t){return function(n,r){t.call(this,n,r);e(this.element).trigger({type:n,gesture:r})}}(t.Manager.prototype.emit)})</script>

html+css+js手机页面左右切换效果

6、书写sliding.jsjs代码。<script>$(document).ready(function (){ $("ul").initslide( { } );});</script>

html+css+js手机页面左右切换效果

7、代码整体结构。

html+css+js手机页面左右切换效果

8、查看效果。

html+css+js手机页面左右切换效果
  • 属猴适合养什么植物
  • 编程语言c语言程序的结构特点是什么呢?
  • 驾照考试:坡道定点停车与起步攻略
  • 杭州科目二、三预约攻略
  • Photoshop图层基础知识以及基本的操作
  • 热门搜索
    食品药品安全手抄报 低碳环保手抄报内容 手抄报花边边框大全 历史手抄报图片大全 儿童安全手抄报大全 最简单的手抄报 关于曹文轩的手抄报 母爱的手抄报 反腐倡廉手抄报内容 读书月手抄报