zepto 追加 html,zepto.html
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
登录
商品分类
商品分类
商品分类
商品分类
商品分类
商品分类
商品分类
商品分类
$(function () {
var banner = $('.jd_banner');
var bannerWidth = banner.width();
var imgBox = $('.banner_img');
var circle = $('.banner_circle').find('li');
var first = imgBox.find('li:first-of-type');
var last = imgBox.find('li:last-of-type');
imgBox.append(first.clone());
last.clone().insertBefore(first);
var lis = imgBox.find('li');
var count = lis.length;
imgBox.width(bannerWidth * count);
lis.each(function (index, element) {
$(lis[index]).width(bannerWidth);
})
imgBox.css('left',-bannerWidth)
window.onresize = function () {
bannerWidth = banner.width();
imgBox.width(bannerWidth * count);
lis.each(function (index, element) {
$(lis[index]).width(bannerWidth);
})
imgBox.css('left',-bannerWidth)
}
var index = 1;
function imgAnimate() {
imgBox.animate(
{'left':-index * bannerWidth},
500,
'ease-in-out',
function () {
if (index == count -1) {
index = 1;
imgBox.css('left',-index * bannerWidth)
} else if (index == 0) {
index = count - 2;
imgBox.css('left',-index * bannerWidth)
}
circle.removeClass('active').eq(index - 1).addClass('active')
})
}
var timerId;
function startTime () {
timerId = setInterval(function () {
index++;
imgAnimate();
},2000)
}
startTime();
imgBox.on('swipeLeft',function () {
index++;
clearInterval(timerId);
imgAnimate();
startTime()
})
imgBox.on('swipeRight',function () {
index--;
clearInterval(timerId);
imgAnimate();
startTime()
})
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史
zepto 追加 html,zepto.html相关推荐
- 【Zepto笔记】Zepto.js
Zepto.js Zepto 简介 jQuery 与 Zepto 的区别 关于浏览器兼容 既然有了JQuery,为什么要Zepto呢 Zepto 设计模块 Zepto 案例 选择器案例 动画案例 动画 ...
- 移动html5 滑动 zepto,GitHub - webzhongwang/zepto.easyh5: 快速开发html5移动应用页面
zepto.easyh5 快速构建html5移动应用 功能介绍 实现移动端的单页全屏滚动,参数自定义,预定义移动端开发常用的CSS3动画. 依赖包 在线演示 安装 项目克隆 git clone git ...
- zepto html 方法,Zepto.js 核心方法
$( ) 1.$( htmlString ) 创建元素//创建元素 var p1 =$(' Hello Zepto '); $('body').append(p1); 2.$( htmlString, ...
- zepto 添加css,zepto 的 css 方法 -- 待续
获取样式: getComputedStyle 什么是计算后的样式 就是经过css样式组合 和 js操作后 的 最后的结果 设置样式有三种方法: div.style.backgroundColor = ...
- Zepto源码分析-zepto模块
源码 //Zepto.js//(c) 2010-2015 Thomas Fuchs//Zepto.js may be freely distributed under the MIT license. ...
- zepto为什么不支持animate,报animate is not a function
在zepto.min.js文件中搜索animate看有没有,如果没有就是没有加入animate的模块 解决办法,去github中打开src/文件夹,找到fx.js文件,把内容追加到zepto.min. ...
- Zepto源代码分析之二~三个API
因为时间关系:本次仅仅对这三个API($.camelCase.$.contains.$.each)方法进行分析 第一个方法变量转驼峰:$.camelCase('hello-world-welcome' ...
- zepto和jquery的区别,zepto的不同使用8条小结
1. Zepto 对象 不能自定义事件 例如执行: $({}).bind('cust', function(){}); 结果: TypeError: Object has no method 'a ...
- 读zepto核心源码学习JS笔记(3)--zepto.init()
上篇已经讲解了zepto.init()的几种情况,这篇就继续记录这几种情况下的具体分析. 1. 首先是第一种情况,selector为空 既然是反向分析,那我们先看看这句话的代码; if (!selec ...
最新文章
- 机器人领域牛人和研究组列表
- MySQL中自动增长类型要求
- python ansible_Ansible升级客户机Python2.4至2.7
- Master选举原理
- 210122阶段三进程间信号
- 打印user在指定时间段内做过的personalization detail
- 华为服务器怎么格式化系统,如何格式化服务器
- passive模式 tcp_FTP主动模式和被动模式的比较
- Python是编译运行的
- Atitit 基于图片图像 与文档混合文件夹的分类
- 中药复方在治疗慢性盆腔炎上的应用
- CF乱码问题解决方案
- AndroidStudio导入arr包
- 中国营销杀手独门暗器揭秘
- 【原创】从头开始,使用安卓系统WebView做一个功能强大的Epub阅读器(二)
- python - 文件操作函数练习
- ADF——增广迪基—福勒检验 和 自相关
- OTG 线结构原理及注意事项
- VMware启动报错Attempting to start up from:EFI VMware Virtual SCSI Hard Drive(0.0)
- 实验三、8人智力竞赛抢答电路设计
热门文章
- 若是救得主人性命 水浒传
- 鸿蒙系统靠谱吗,鸿蒙系统好用吗
- ubuntu20 编译 TiFlash
- Git - 什么是 CRLF 和 LF
- 浅谈 SurfaceView、TextureView、GLSurfaceView、SurfaceTexture
- 使用 BR 备份集群
- windows server 2012 服务器nacos 安装配置以及集群搭建
- 关于ModifyStyleEx无效的问题
- 手机号分隔成344的格式
- 访问c:\Users\Administrator\Documents\NetSarang\Xshell\buttonlist.ini时磁盘已满