jQuery 横向滚动图片
作者:张经纬 来源:张经纬的博客 发布时间:2009-03-11 13:09:00
标签:图片,特效,滚动,jquery
1、可以控制左横向滚动还是右横向滚动。
2、鼠标悬停上时暂停滚动,移开后恢复滚动。
3、间歇时间按需调整,但不要低于容器向左/右移动的时间。
JAVASCRIPT代码:
var scrollWrapW,myScroll;
var rollDirection = 0; //0为左 1为右
var speed = 500;
function __scrollBox(){
if (rollDirection == 0){
scrollWrapW = -($('ul li').eq(0).outerWidth(true) + $('ul li').eq(1).outerWidth(true)) + 'px';
$('ul').animate({left:scrollWrapW}, {
duration:200,
complete:function(){
$('ul').append($('ul li:first')).append($('ul li:first'));
$('ul').css("left","0");
}
});
}else{
var last = $('ul li').length - 1;
var last2 = $('ul li').length - 2;
scrollWrapW = -($('ul li').eq(last).outerWidth(true) + $('ul li').eq(last2).outerWidth(true)) + 'px';
$('ul').animate({left:0}, {
duration:200,
complete:function(){
$('ul').prepend($('ul li:last')).prepend($('ul li:last'));
$('ul').css("left",scrollWrapW);
}
});
}
}
$(document).ready(function(){
/* roll control */
myScroll = setInterval(__scrollBox,speed);
$('#scrool_wrap').hover(function(){
clearInterval(myScroll);
},function(){
myScroll = setInterval(__scrollBox,speed);
});
/* left control */
$('.left').click(function(){
rollDirection = 0;
});
$('.right').click(function(){
rollDirection = 1;
});
})
0
投稿
猜你喜欢
- 1. os.listdir()概述os.listdir() 方法用于返回指定的文件夹包含的文件或文件夹的名字的列表。例如:dir ='
- 1 发送文本信息'''加密发送文本邮件'''def sendEmail(from_addr,
- 我一般都是通过xpath解析DOM树的时候会使用lxml的etree,可以很方便的从html源码中得到自己想要的内容。这里主要介绍一下我常用
- 前言上篇介绍了go-grpc-middleware的grpc_zap、grpc_auth和grpc_recovery使用,本篇将介绍grpc
- 一丶为什么需要事务隔离级别mysql是一个客户端/服务端软件,对于同一个服务器来说,可以有多个客户端进行连接,每一个客户端进行连接之后就形成
- 假设有两个dict x和y,合并成一个新的dict,不改变 x和y的值,例如x = {'a': 1, 'b'
- useSSL=false和true的区别SSL(Secure Sockets Layer 安全套接字协议),在mysql进行连接的时候,如果
- 一、简介 py2exe是一个将python脚本转换成windows上的可独立执行的可执行程序(*.exe)的工具,这样,你就可以不用装pyt
- 本文实例讲述了php输出指定时间以前时间格式的方法。分享给大家供大家参考。具体分析如下:比如说你需要在php中输出3天前,20分钟以前,可以
- <base href="http://digi.tech.qq.com/images/ld/2007/1022/
- 本文实例为大家分享了Python制作简易计算器的具体代码,供大家参考,具体内容如下简易计算器简易计算器功能:实现输入,计算,输出功能;可以计
- objectobject 是 Python 为所有对象提供的父类,默认提供一些内置的属性、方法;可以使用 dir 方法查看新式类以 obje
- 大家在安装程序或下载文件时,通常都能看到进度条,提示你当前任务的进度。其实,在python中实现这个功能很简单,下面是具体代码。在实际应用中
- join toString该两种方法会将数组元素的类型转换为字符串var arr = [1, [2, [3, [4, 5]]], 6];co
- 本文默认你的开发环境.数据库已经安装好想用使用数据库.我们需要现在pom文件中添加相应的依赖pom.xml<?xml version=
- 当模型models.py中发生改变时,即在models.py文件操作数据表,使得数据库中的表结构发生变化,需要使用命令,记录这些操作,类似于
- Software as a service 软件即服务,21世纪开始兴起的一种完全创新的软件应用模式。客户通过互联网向厂商定购所需的应用软件
- 过拟合问题实战1.构建数据集我们使用的数据集样本特性向量长度为 2,标签为 0 或 1,分别代表了 2 种类别。借助于 scikit-lea
- 需要先安装 tabulate 模块:pip3 install tabulate以上是把一维的dict打印出来.再看看二维的,list-of-
- 话不多说 直接上代码<el-upload :action="actionUrl&q