滑动事件左右滑动
来源:互联网 发布:淘宝智能版首页尺寸 编辑:程序博客网 时间:2024/03/28 22:25
滑动事件左右滑动:
function slideEvent(id) { var UlWidth = 0; var touchStart, touchEnd, moveLength, startML, maxML; var $shop2 = $('#' + id); $shop2.find('li').each(function(){ UlWidth += $(this).outerWidth(); }) $shop2.width(UlWidth); maxML = UlWidth - $(window).width(); if(maxML > 0){ $shop2.bind('touchstart', function(e){ touchStart = e.originalEvent.targetTouches[0].pageX; startML = $shop2.css('margin-left'); }).bind('touchmove', function(e){ touchEnd = e.originalEvent.targetTouches[0].pageX; moveLength = touchEnd - touchStart + parseInt(startML); $shop2.css('margin-left', moveLength) }).bind('touchend', function(){ if(moveLength > 0){ moveLength = 0; }else if(moveLength < -maxML){ moveLength = -maxML; } $shop2.animate({'marginLeft': moveLength}, 200); }) }}slideEvent('shop2');
注:id 为绑定的 唯一标识如:
<div id="shop2"></div>
阅读全文
0 0
- 滑动事件左右滑动
- android 左右滑动事件
- ViewFlipper左右滑动事件
- ViewFlipper左右滑动事件
- 禁止ViewPager左右滑动事件
- android监听左右滑动事件
- 触摸左右滑动发生事件
- ViewPage左右滑动和PullToRefreshListView上下滑动事件冲突
- android onTouchEvent 左右手势滑动事件处理
- android onTouchEvent 左右手势滑动事件处理
- 为UITableView增加左右滑动事件
- js的左右滑动触屏事件
- 为UITableView增加左右滑动事件
- android onTouchEvent 左右手势滑动事件处理
- android onTouchEvent 左右手势滑动事件处理
- android onTouchEvent 左右手势滑动事件处理
- android onTouchEvent 左右手势滑动事件处理
- android onTouchEvent 左右手势滑动事件处理
- 7.18
- win10 uwp 使用 Geometry resources 在 xaml
- k近邻算法简介及源代码(含图象打印)
- 常用 Java 静态代码分析工具的分析与比较
- Python:旋转数组的最小数字
- 滑动事件左右滑动
- 【数据库】隔离级别,锁基础,一致性锁定/非锁定 读
- java 中break、continue、return异同
- Linux关闭selinux安全子系统
- Socket通信
- 剑指offer-输入一个链表,从尾到头打印链表每个节点的值
- JS中类的创建与继承的理解
- Android 四大组件(四)BroadcastReceiver
- 算法系列——Unique Paths