Css实现:
#hero img{ width: 100%; height: 100%; } #hero div{ position: absolute; top: 0px; left: 0px; display: none; z-index: 5; opacity: 0; width: 645px; height: 590px; } #hero-pager { z-index: 2; text-align: center; margin: 20px 0; } #hero-pager a { margin: 0 4px; display: inline-block; width: 14px; height: 14px; border-radius: 14px; text-indent: -3000em; background-color: #D0D0D0; vertical-align: middle; } #hero-pager a.activeSlide { width: 21px; height: 21px; border-radius: 21px; background-color: #85C637; }
Html实现:
<div id="hero" style="display: table-cell;position: relative; width: 645px; height: 590px;"> <div> <img src="https://www.yapp.us/images/home/hero/derek.jpg" /> </div> <div> <img src="https://www.yapp.us/images/home/hero/julie.jpg" /> </div> <div> <img src="https://www.yapp.us/images/home/hero/dan.jpg" /> </div> <div> <img src="https://www.yapp.us/images/home/hero/wojtek.jpg" /> </div> <div> <img src="https://www.yapp.us/images/home/hero/caitlin.jpg" /> </div> </div> <div class="hero-controls"> <div id="hero-pager"> <a href="#" class="activeSlide">*</a><a href="#" class="">*</a><a href="#">*</a><a href="#" class="">*</a><a href="#" class="">*</a></div> </div>
Js实现:
var curIndex = 0; setInterval(function(){ curIndex = (curIndex >= $("#hero-pager a").size() ? 0 : curIndex); $("#hero-pager a").removeClass("activeSlide").eq(curIndex).addClass("activeSlide"); $("#hero div").css({"display":"none","z-index":"5","opacity":"0"}).eq(curIndex).css({"display":"block","z-index":"6","opacity":"1"}); curIndex++; }, 3000); $("#hero-pager a").hover(function(){ $("#hero-pager a").removeClass("activeSlide"); $(this).addClass("activeSlide"); curIndex = $("#hero-pager a").index(this); $("#hero div").css({"display":"none","z-index":"5","opacity":"0"}).eq(curIndex).css({"display":"block","z-index":"6","opacity":"1"}); }).click(function(){ $("#hero div").css({"display":"none","z-index":"5","opacity":"0"}).eq(curIndex).css({"display":"block","z-index":"6","opacity":"1"}); return false; });
相关推荐
Jquery图片轮播幻灯片效果实现左右滚动图片切换代码
jQuery实现的图片轮播,可直接运行,含有详细的解释,可以帮助理解jQuery。
jQuery图片左右滚动效果代码是一款带左右箭头,自动轮播的jQuery图片切换特效。
jQuery图片轮播切换代码是一款美女网站用的带左右箭头自动轮播切换的焦点图幻灯片代码。
JQuery代码实现图片切换轮播效果源码免费下载
脚本简介jQuery带进度条滚动图片轮播代码是一款带左右箭头按钮控制图片滚动轮播,标题和进度条显示效果。
jQuery图片自动轮播淡入淡出的幻灯插件iFadeSlide jQuery大气banner带时间线自动播放的焦点图轮番切换代码 jquery定时自动切换banner广告图片动画插件示例 jquery实现LightBox图片点击放大效果的图片盒子插件 jQuery...
jQuery轮播图、图片切换、图片轮播 代码简介:兼容IE8的jQuery轮播图插件是一款兼容性很好的,使用非常简单的网站焦点图代码,依赖jquery和pageSwitch.js来实现轮播效果,轮播图以背景图的方式插入到当前页面进行...
首先是初始化部分:将除了第一张轮播图片意外的图片都隐藏,并且隐藏向前、向后按钮,使第一个索引按钮处于激活状态。 事件部分:通过jquery的hover()绑定鼠标上悬以及离开时的事件处理, jquery的bind()方法绑定...
扁平按钮jQuery图片切换代码是一款jquery实现的带数字按钮的焦点图代码。
jquery实现的多图无缝轮播切换图片代码,让你的网站像京东淘宝一样简洁大气
这是一个不错的jquery轮播的代码,可以下载下来看一下
jQuery实现水平手风琴图片轮播切换特效代码.zip
jquery实现3D旋转轮播图片代码
jQuery图片分层轮播3d旋转切换代码是一款基于jquery.zySlide插件实现的图片轮播切换特效。
带左右箭头jQuery焦点图片切换代码 带左右箭头jQuery焦点图片切换代码
jQuery左侧图片右侧文字滑动切换代码是一款基于jQuery实现的列表图片控制图片滑动切换代码。
jquery实现跨平台图片轮播代码.zip
jquery实现淘宝/京东轮播图效果源码、直接可用、可直接传递JSON、或者通过AJAX从数据库获取images路径