jqeury之平移轮播
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="yangshi/css.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.7.2.min.js" type="text/javascript"></script> <script type="text/javascript">
$(function () {
var timer; //定时器
var curno = 1;
var length = $(".lunbo ul li").length; //有几张图片
$(".lunbo ul").css("width", length * 137 + "px"); $(".topimg").hover(function () {
//鼠标移上去执行的内容 clearInterval(timer);
}, function () {
//鼠标移走时执行的内容 timer = setInterval(scroll, 3000);
}).trigger("mouseover"); //trigger("mouseover")窗体加载的时候就触发一次mouseover事件
$(".lunbo").hover(function () {
//鼠标移上去执行的内容 clearInterval(timer);
}, function () {
//鼠标移走时执行的内容 timer = setInterval(scroll, 3000);
}) $(".lunbo .bl").click(function () {
if (curno == 0) { }
else {
curno--;
}
$(".lunbo .thumb .li ul li").eq(curno).fadeTo(1000, 1).siblings().fadeTo(1000, 0.3);
var src = $(".lunbo .thumb .li ul li:eq(" + curno + ") img").attr("src");
$(".topimg img").attr("src", src); //上面图片显示 if (curno == 0) {
$('.lunbo ul').stop(true, false).animate({ left: "0px" }, 1000);
} else if (curno > 2 && curno + 2 < length) {
$(".lunbo ul").css("margin-left", 0);
var nowLeft = -(curno - 2) * "137" + "px";
$('.lunbo ul').stop(true, false).animate({ left: nowLeft }, 1000);
} }) $(".lunbo .br").click(function () {
if (curno == 0) { }
else {
curno++;
}
$(".lunbo .thumb .li ul li").eq(curno).fadeTo(1000, 1).siblings().fadeTo(1000, 0.3);
var src = $(".lunbo .thumb .li ul li:eq(" + curno + ") img").attr("src");
$(".topimg img").attr("src", src); //上面图片显示 if (curno == 0) {
$('.lunbo ul').stop(true, false).animate({ left: "0px" }, 1000);
} else if (curno > 2 && curno + 2 < length) {
$(".lunbo ul").css("margin-left", 0);
var nowLeft = -(curno - 2) * "137" + "px";
$('.lunbo ul').stop(true, false).animate({ left: nowLeft }, 1000);
} }) function scroll() {
//轮播图高亮显示
$(".lunbo .thumb .li ul li").eq(curno).fadeTo(1000, 1).siblings().fadeTo(1000, 0.3);
var src = $(".lunbo .thumb .li ul li:eq(" + curno + ") img").attr("src");
$(".topimg img").attr("src", src); //上面图片显示 if (curno == 0) {
$('.lunbo ul').stop(true, false).animate({ left: "0px" }, 1000);
} else if (curno > 2 && curno + 2 < length) {
$(".lunbo ul").css("margin-left", 0);
var nowLeft = -(curno - 2) * "137" + "px";
$('.lunbo ul').stop(true, false).animate({ left: nowLeft }, 1000);
} curno++; if (curno == length) {
curno = 0;
} }
})
</script>
</head>
<body>
<div class="topimg"><img src="data:image/1.jpg" /></div>
<div class="lunbo">
<div class="thumb">
<div class="b bl"></div>
<div class="li">
<ul>
<li><img src="data:image/1.jpg" /></li>
<li><img src="data:image/2.jpg" /></li>
<li><img src="data:image/3.jpg" /></li>
<li><img src="data:image/4.jpg" /></li>
<li><img src="data:image/5.jpg" /></li>
<li><img src="data:image/6.jpg" /></li>
<li><img src="data:image/7.jpg" /></li>
</ul>
</div>
<div class="b br"></div>
</div>
</div> </body>
</html>
jqeury之平移轮播的更多相关文章
- javascript写无缝平移的轮播图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js各种特效轮播图,选项卡,放大镜,窗口拖拽,楼层跳转
// 透明度轮播图 // img:轮播图片 // dot:轮播点 // lbtn:左箭头 // rbtn:右箭头 // banner:轮播盒子 // active:轮播点选中效果类名 // time: ...
- 用JQ去实现一个轮播效果
前提:用JQ去实现轮播效果一步步的做一个梳理. 首先肯定是轮播的HTML和CSS样式了: <body> <div class="pic"> <div ...
- CSS动画之旋转魔方轮播
很久没有回头来复习CSS方面的知识了, 正好又到了月底写文章的deadline......所以这次选择了详细巩固一下CSS3动画有关的知识点,因为之前只是用过一些属性并没有深究细节. 在我自己写完这篇 ...
- 原生js实现响应式轮播图,支持电脑端点击切图,手机端滑动切图
轮播图的实现原理并不难,但是步骤有些繁琐.最近练习了一个轮播图,大部分是跟着网上的教程写的,然后自己做了一点兼容ie8的修改,加了点击切换图片的特效和手机端的滑动特效,让这个轮播图可以在响应式的网站中 ...
- 踩石行动:ViewPager无限轮播的坑
2016-6-19 前言 View轮播效果在app中很常见,一想到左右滑动的效果就很容易想到使用ViewPager来实现.对于像我们常说的banner这样的效果,具备无限滑动的功能是可以用ViewPa ...
- 原生js+css3实现图片自动切换,图片轮播
运用CSS3transition及opacity属性 制作图片轮播动画 自己这两天根据用js来控制触发CSS3中transition属性,从而写出来的以CSS3动画为基础,js控制过程的图片轮播 运用 ...
- 纯javaScript、jQuery实现个性化图片轮播
纯javaScript实现个性化图片轮播 轮播原理说明<如上图所示>: 1. 画布部分(可视区域)属性说明:overflow:hidden使得超出画布部分隐藏或说不可见.position: ...
- jQuery个性化图片轮播效果
jQuery个性化图片轮播效果 购物产品展示:图片轮播器<效果如下所示> 思路说明: 每隔一段时间,实现图片的自动切换及选项卡选中效果,鼠标划入图片动画停止,划出或离开动画开始 两个区域: ...
随机推荐
- css 滑动按钮样式
<div class="pub_switch_box"> <input type="checkbox" id="pub_switch ...
- Codeforce Round #224 Div2
一下子没打,这比赛,就被虐成狗!
- 转:python webdriver API 之浏览器的操作
1.1.浏览器最大化在统一的浏览器大小下运行用例,可以比较容易的跟一些基于图像比对的工具进行结合,提升测试的灵活性及普遍适用性.比如可以跟 sikuli 结合,使用 sikuli 操作 flash.# ...
- 2-sat(and,or,xor)poj3678
Katu Puzzle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7949 Accepted: 2914 Descr ...
- how to use automapper in c#, from cf~
[DataContract] public class GroupDto { [DataMember] public int id { get; set; } [DataMember] public ...
- android开发之如何使TabHost的TabWidget位于屏幕下方
更改TabHost里的第一个LinearLayout为RelativeLayout.并在TabWidget中添加android:layout_alignParentBottom="true& ...
- windows namedPipe 命名管道clent and server
1.client: #include "iostream" #include "windows.h" using namespace std; void mai ...
- 通过struts.xml搭建、为属性注入值_2015.01.04
01:web.xml配置: <?xml version="1.0" encoding="UTF-8"?> <web-app version=& ...
- 反射认识_03_改变成员变量Fields
包01:package ReflectionChange; public class ReflectionPoint_AB { String str1="access"; Stri ...
- Oracle的分页查询
--1:无ORDER BY排序的写法.(效率最高)--(经过测试,此方法成本最低,只嵌套一层,速度最快!即使查询的数据量再大,也几乎不受影响,速度依然!) SELECT * FROM (SELECT ...