滑动tab及3d翻页组件

栏目: JavaScript · 发布时间: 6年前

内容简介:touchstart: //手指放到屏幕上时触发touchmove: //手指在屏幕上滑动时触发touchend: //手指离开屏幕时触发
滑动tab及3d翻页组件

基本思路

1.监听以下touch事件

touchstart: //手指放到屏幕上时触发

touchmove: //手指在屏幕上滑动时触发

touchend: //手指离开屏幕时触发

2.计算滑动值并设置

在touchmove事件回调中动态设置容器的transform中的translate3d属性,以达到tab随滑动而移动的效果

3.在touchend回调中设置滑动切换tab的阈值

即在tab滑动超出一定阈值时释放,tab自动切换

在线浏览

推荐手机访问

源码

详见我的github

翻页组件(touch-flipbook)

滑动tab及3d翻页组件

dom结构

<div class="touch-flipbook" ref="touchCon" @touchstart.prevent="TouchStart" @touchmove.prevent="TouchMove"
@touchend="TouchEnd">
    <div class="page p0">
    <!-- /* page有前后两面 */ -->
        <div class="front">0正</div>
        <div class="back">0反</div>
    </div>
    <!-- /* page2为翻页之后显示的*/  -->
    <div class="page p1">
        <div class="front">1正</div>
        <div class="back">1反</div>
    </div>
    <div class="page p2">
        <div class="front">2正</div>
        <div class="back">2反</div>
    </div>
</div>
复制代码

touch事件的处理与上述滑动Tab的处理方式大致相同,不同在于

此处需动态设置为transform中的rotate属性。

需要注意的有以下几点:

scaleY(1)

以上所述就是小编给大家介绍的《滑动tab及3d翻页组件》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Database Design and Implementation

Database Design and Implementation

Edward Sciore / Wiley / 2008-10-24 / 1261.00 元

* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码

html转js在线工具
html转js在线工具

html转js在线工具