jquery 图片自动切换
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JQUERY实现图片自动切换</title>
<style>
body{margin:0px; padding:0px; font-family:Arial}
ul{list-style:none;margin:0px;padding:0px}
.click_out{margin-left:5px; float:left; text-align:center; height:16px; line-height:16px; width:16px; background:#333; color:#FFF; font-weight:bold; font-size:12px; cursor:pointer;_display:inline-block; }
.click_over{margin-left:5px; float:left;text-align:center; height:16px; line-height:16px; width:16px; background:#820000; color:#FFF; font-weight:bold; font-size:12px; cursor:pointer; _display:inline-block; }
</style>
<script language="javascript" src="../Script/jquery-1.4.4.min.js"></script>
</head>
<body>
<div style="height:230px; width:980px; background:#EBEBEB; position:relative" id="flash_outer">
<div style=" position:absolute; left:0px; top:0px; width:980px; height:230px; overflow:hidden" id="flash_pic">
<div style="width:980px; height:250px; background:url(flash_pic/1.jpg)"></div>
<div style="width:980px; height:250px; background:url(flash_pic/2.jpg)"></div>
<div style="width:980px; height:250px; background:url(flash_pic/3.jpg)"></div>
<div style="width:980px; height:250px; background:url(flash_pic/4.jpg)"></div>
</div>
<ul style="position:absolute; right:0px; bottom:0px; height:16px" id="flash_num">
<li class="click_over">1</li>
<li class="click_out">2</li>
<li class="click_out">3</li>
<li class="click_out">4</li>
</ul>
</div>
<script language="javascript">
$(document).ready(function()
{
var len=$("#flash_num>li").length;
var index=1;
var int;
function showSys(num) //图片切换函数
{
$("#flash_num>li").removeClass().addClass("click_out").eq(num).toggleClass("click_out").addClass("click_over");
$("#flash_pic>div").fadeOut().eq(num).fadeIn();
}
function ziDong() //自动切换
{
if(index==len)
{
index=0;
}
showSys(index);
index=index+1;
}
int=setInterval(ziDong,3000);
$("#flash_num>li").click(function() //点击切换
{
var index_num=$("#flash_num>li").index(this);
showSys(index_num);
index=index_num+1; //改变全局变量的值,以便鼠标移开的时候能够衔接上
//$(".click_out").removeClass("click_over").eq(index).addClass("click_over");
//$(".click_out").eq(index).removeClass().addClass("click_over");
//alert(index);
});
$("#flash_outer").mouseover(function() //移动到上面时停止自动切换
{
clearInterval(int);
});
$("#flash_outer").mouseout(function() //移开时继续自动切换
{
int=setInterval(ziDong,3000);
});
});
</script>
</body>
</html>
jquery 图片自动切换的更多相关文章
- jquery背景自动切换特效
查看效果网址:http://keleyi.com/a/bjad/4kwkql05.htm 本特效的jquery版本只支持1.9.0以下. 代码如下: <!DOCTYPE html PUBLIC ...
- 原生js+css3实现图片自动切换,图片轮播
运用CSS3transition及opacity属性 制作图片轮播动画 自己这两天根据用js来控制触发CSS3中transition属性,从而写出来的以CSS3动画为基础,js控制过程的图片轮播 运用 ...
- js实现图片自动切换效果。
js实现图片自动切换效果,简单实用,原谅我只是一只小菜鸟还在学大神天天写博文装逼. <script language="javascript"> setInterval ...
- jquery 图片自动无缝滚动
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-e ...
- jQuery图片自动添加水印插件
JS脚本(jQuery)为图片加水印效果预览:http://hovertree.com/texiao/jquery/94/ 本功能使用HTML5实现,可为图片加上文字水印,可设置文字,设置颜色,位置等 ...
- tab切换效果 网站中的图片自动切换
网站中的图片自动切换 今天上一套tab切换效果的代码 动图就自己实现吧! 下面贴HTML代码,大体分两部分,图片div和按钮div,代码很容易看懂~ <!DOCTYPE html> < ...
- jquery图片播放切换插件
点击这里查看效果可自定义数字样式和左右点击按钮 这个更好:移入按钮切换版本 更多图片轮播 以下是HTML文件代码: <!DOCTYPE html PUBLIC "-//W3C//DTD ...
- 利用JS实现点击按钮后图片自动切换
我么常常看到一个网站的主界面的图片可以切换自如,那么又是如何实现的呢? 1.HTML页面布局如图所示: Main(div) top(div)(显示需要显示的图片) bottom UL (li)< ...
- jquery 图片无缝切换
想要和园友分享一下学习jquery的经验.总结,更希望园友提出点建议. 第一次写,有不好的地方请多多见谅! 文笔有限,很多时候不知道怎么来描述,唉.硬伤啊!!那只好多做了,贴代码... ok,废话少说 ...
随机推荐
- codevs 1214 线段覆盖
1214 线段覆盖 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 给定x轴上的N(0<N<100)条线段,每个线段 ...
- [BZOJ5334][TJOI2018]数学计算(exgcd/线段树)
模意义下除法若结果仍为整数的话,可以记录模数的所有质因子,计算这些质因子的次幂数,剩余的exgcd解决. $O(n\log n)$但有9的常数(1e9内的数最多有9个不同的质因子),T了. #incl ...
- POJ 3904 JZYZOJ 1202 Sky Code 莫比乌斯反演 组合数
http://poj.org/problem?id=3904 题意:给一些数,求在这些数中找出四个数互质的方案数. 莫比乌斯反演的式子有两种形式http://blog.csdn.net/out ...
- Spring 注解大全与详解
Spring使用的注解大全和解释 注解 解释 @Controller 组合注解(组合了@Component注解),应用在MVC层(控制层),DispatcherServlet会自动扫描注解了此注解的类 ...
- UESTC 2015dp专题 N 导弹拦截 dp
导弹拦截 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/contest/show/65 Descrip ...
- hdu 5195 DZY Loves Topological Sorting 线段树+拓扑排序
DZY Loves Topological Sorting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/sho ...
- 装饰者模式:轻松记住IO类的关系与API
开门见山 目录 概述与模型 1.概述 含义:动态地将责任附加到对象上.若要拓展功能,装饰者提供了比继承更有弹性的替代方案. 初衷:需要动态为某一个类拓展.通常我们会使用继承,但是继承的话,会产生很多子 ...
- SecureCRT也能和Xshell一样批量导入主机
在Xshell可以像这样一个文件批量导入主机: https://blog.netsarang.com/91/importing-csv-formatted-host-information-to-xs ...
- Spring MapFactoryBean例子
MapFactoryBean类为开发者提供了一种在Spring的bean配置文件中创建一个具体的Map集合类(HashMap和TreeMap). 这里有一个MapFactoryBean.例如,在运行时 ...
- linkhashmap实现原理
HashMap和双向链表合二为一即是LinkedHashMap.所谓LinkedHashMap,其落脚点在HashMap,因此更准确地说,它是一个将所有Entry节点链入一个双向链表的HashMap. ...