Jquery实现简单图片轮播
html代码:
<div class="show">
<div class="left">
<div class="show_content">
<img src="img/3.jpg" alt="" style="width:695px;height: 612px">
<img src="img/4.jpg" alt="" style="width:695px;height: 612px">
<img src="img/5.jpg" alt="" style="width:695px;height: 612px">
<img src="img/6.jpg" alt="" style="width:695px;height: 612px">
</div>
</div>
<div class="right">
<ul>
<li>
<img src="img/3.jpg" alt="">
<img src="img/4.jpg" alt="">
<img src="img/5.jpg" alt="">
<img src="img/6.jpg" alt="">
</li>
</ul>
</div>
</div>
css 代码:
*{
margin:;
padding:;
}
.show{
width: 800px;
height: 612px;
border: 1px solid blue;
margin: 0 auto;
}
li{
list-style: none;
}
li img{
float: right;
padding-top: 5px;
padding-left: 5px;
}
li{
width: 100px;
}
.left{
width: 695px;
height: 612px;
/* background-color: black; */
float: left;
}
.right{
float: left;
}
script 代码:
var ind = 0 ;
var timeplay = null;
// 显示第一张
$('.show_content img').eq(0).show().siblings('img').hide();
$('li img').hover(function(){
clearInterval(timeplay);
ind = $(this).index();
$(this).removeClass('hover'); // 取消第一个li标签里的img的透明
//给下一标签添加 hover属性
$(this).siblings().addClass('hover');
// $('.show_content img').eq(ind).fadeIn().siblings().fadeOut();
$('.show_content img').eq(ind).show().siblings().hide(); },function(){
autoplay();
}) // 自动轮播
function autoplay(){
timeplay = setInterval(function(){
ind++;
if(ind>3){
ind=0;
}
$('li img').eq(ind).removeClass('hover');
$('li img').eq(ind).siblings().addClass('hover');
// $('.show_content img').eq(ind).fadeIn().siblings().fadeOut();
$('.show_content img').eq(ind).show().siblings().hide();
},1000)
} autoplay();
使用的jquery版本

实现的代码效果:

Jquery实现简单图片轮播的更多相关文章
- 使用javascript,jquery实现的图片轮播功能
使用javascript,jquery实现的图片轮播功能本功能采用最基础的javascript和一些简单的jquery技术实现,易理解,以修改使用,代码简易,适合刚开始接触到网站开发的朋友们参考.可以 ...
- jQuery轻量级京东图片轮播代码等
http://sc.chinaz.com/jiaoben/jiaodiantu.html jQuery轻量级京东图片轮播代码 查看全图点击预览 顶(17)踩(4)报错评论(0)下载地址 更新时间: ...
- html学习之路--简单图片轮播
一个简单的图片轮播效果 photo.html页面代码,基本的HTML结构,在main中显示图片,此处图片依次命名为1.jpg.2.jpg.3.jpg.4.jpg. <!DOCTYPE html& ...
- JQuery slidebox实现图片轮播
jQuery图片轮播(焦点图)插件jquery.slideBox,简单设置下参数就可以多个多种动画效果,左右,上下,速度,还可指定默认显示第N张,点击的按钮在现代浏览中可以实现圆形或圆角效果,插件代码 ...
- 纯javaScript、jQuery实现个性化图片轮播
纯javaScript实现个性化图片轮播 轮播原理说明<如上图所示>: 1. 画布部分(可视区域)属性说明:overflow:hidden使得超出画布部分隐藏或说不可见.position: ...
- JQuery插件之图片轮播插件–slideBox
来源:http://www.ido321.com/852.html 今天偶然发现了一个比较好用的图片轮播插件—slideBox 先看看效果:http://slidebox.sinaapp.com/ 代 ...
- js/jquery中实现图片轮播
一,jquery方法 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type&qu ...
- JQuery插件开发初探——图片轮播
在熟悉了插件开发的结构以后,自己尝试着做了一个稍微复杂一点的小功能:图片轮播插件. 由于之前使用的一款图片轮播插件,性能不高,页面加载的时候需要载入全部的图片,因此速度很慢. 通过自己做这个小插件,能 ...
- jquery视频展示 图片轮播
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- IE6 行内定义成块元素后高度失效
问题描述: ie6下,空标签块元素height定义失效,表现为除设置的height值外还会显示N像素额外的高度. 实际运用中,若标签为空且定义了小于14px的高度,再加入一背景图的话,会发现该元素高度 ...
- 用CSS隐藏页面元素的5种方法
1.opacity设置一个元素的透明度只是从视觉上隐藏元素,对页面布局还是有影响,读屏软件会原样读出 2.visibility设置为hidden将隐藏我们的元素,对网页布局还是起作用,子元素也会被隐藏 ...
- Web.py报错:OSError: No socket could be created -- (('0.0.0.0', 8080):
web.py报错 Python代码: import web urls = ( '/(.*)', 'hello' ) app = web.application(urls, globals()) cla ...
- 应该是很简单的事,关于SQL2005的视图浏览不排序问题
http://bbs.csdn.net/topics/390667337?page=1
- TextSwitcher(文本切换器)和ViewFlipper
1.TextSwitcher 使用: 应用分为三步: 1.得到 TextSwitcher 实例对象 TextSwitcher switcher = (TextSwitcher) findViewB ...
- qt 使用qtxlsx 读写excel
https://github.com/dbzhang800/QtXlsxWriter 下载qtxlsx地址 QtXlsx is a library that can read and write Ex ...
- vs2013 c# 中调用 c 编写的dll出错的可能错误
先说出错原因: 堆栈调用顺序 解决办法: 使用 __stdcall 或 使用C#属性 CallingConvention 起因是我想在c#中调用c函数结果出错了 如下 C 头文件 ...
- 故障排除:无法启动、访问或连接到 Azure 虚拟机上运行的应用程序
有多种原因可导致无法启用或连接到在 Azure 虚拟机 (VM) 上运行的应用程序.原因包括应用程序未在预期端口上运行或侦听.侦听端口受到阻止,或网络规则未将流量正确传递到应用程序.本文说明有条理地找 ...
- Web API 2 入门——Web API 2中的操作结果(谷歌翻译)
在这篇文章中 空虚 HttpResponseMessage IHttpActionResult 其他返回类型 作者:Mike Wasson 本主题描述ASP.NET Web API如何将控制器操作的返 ...
- 【Leetcode】【Medium】Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...