jquery圖片輪播特效代碼分享
本文實(shí)例講述了jquery圖片輪播特效。分享給大家供大家參考。具體如下:
這是一款仿淘寶首頁(yè)jquery輪播焦點(diǎn)圖,基于jquery實(shí)現(xiàn)仿淘寶網(wǎng)首頁(yè)正中間小焦點(diǎn)圖特效。
運(yùn)行效果圖:
-------------------查看效果 下載源碼-------------------

小提示:瀏覽器中如果不能正常運(yùn)行,可以嘗試切換瀏覽模式。
為大家分享的jquery圖片輪播特效代碼如下
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>仿淘寶首頁(yè)jquery輪播焦點(diǎn)圖</title>
<style>
body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,dl,dt,dd,input{margin:0;padding:0;}
body{font-size:12px;}
img{border:none;}
li{list-style:none;}
input,select,textarea{outline:none;}
textarea{resize:none;}
a{text-decoration:none;}
/*清浮動(dòng)*/
.clearfix:after{content:"";display:block;clear:both;}
.clearfix{zoom:1;}
.banner{width:520px; height:280px; position:relative; overflow:hidden;}
.banner-btn{ display:none;}
.banner-btn a{ display:block; line-height:40px; position:absolute;top:120px; width:40px; height:40px;background-color: #000; opacity:0.3; filter:alpha(opacity=30) color: rgb(255, 255, 255);overflow: hidden; z-index:4;}
.prevBtn{left:5px;}
.nextBtn{right:5px;}
.banner-img{ font-size:0; *word-spacing:-1px;/* IE6、7 */ letter-spacing: -3px; position:relative;}
.banner-img li{ display:inline-block;*display:inline;*zoom:1;/* IE6、7 */ vertical-align: top; letter-spacing: normal;word-spacing: normal; font-size:12px;}
.banner i{ background:url(http://gtms01.alicdn.com/tps/i1/T1szNBFzlmXXX8QSDI-400-340.png) no-repeat; width: 15px;height: 23px; cursor:pointer;margin: 8px 0 0 12px; display:block;}
.banner .nextBtn i{ background-position:-200px -24px;}
.banner .prevBtn i{ background-position:-200px 0px;}
.banner-circle{ position:absolute; left:50%; bottom: 15px;height: 13px;text-align: center;font-size: 0;border-radius: 10px; background:rgba(255,255,255,0.3); filter:alpha(opacity:30); }
.banner-circle li{ border-radius: 10px; margin:2px; display: inline-block; display: -moz-inline-stack; vertical-align: middle;zoom: 1; }
.banner-circle li a{ display: block;padding-top: 9px;width: 9px;height: 0;border-radius: 50%; background: #B7B7B7;overflow: hidden;}
.banner-circle .selected a{ background:#F40; }
</style>
<script src="js/jquery.min.js">
</script>
<script>
$(function(){
var $banner=$('.banner');
var $banner_ul=$('.banner-img');
var $btn=$('.banner-btn');
var $btn_a=$btn.find('a')
var v_width=$banner.width();
var page=1;
var timer=null;
var btnClass=null;
var page_count=$banner_ul.find('li').length;//把這個(gè)值賦給小圓點(diǎn)的個(gè)數(shù)
var banner_cir="<li class='selected' href='#'><a></a></li>";
for(var i=1;i<page_count;i++){
//動(dòng)態(tài)添加小圓點(diǎn)
banner_cir+="<li><a href='#'></a></li>";
}
$('.banner-circle').append(banner_cir);
var cirLeft=$('.banner-circle').width()*(-0.5);
$('.banner-circle').css({'marginLeft':cirLeft});
$banner_ul.width(page_count*v_width);
function move(obj,classname){
//手動(dòng)及自動(dòng)播放
if(!$banner_ul.is(':animated')){
if(classname=='prevBtn'){
if(page==1){
$banner_ul.animate({left:-v_width*(page_count-1)});
page=page_count;
cirMove();
}
else{
$banner_ul.animate({left:'+='+v_width},"slow");
page--;
cirMove();
}
}
else{
if(page==page_count){
$banner_ul.animate({left:0});
page=1;
cirMove();
}
else{
$banner_ul.animate({left:'-='+v_width},"slow");
page++;
cirMove();
}
}
}
}
function cirMove(){
//檢測(cè)page的值,使當(dāng)前的page與selected的小圓點(diǎn)一致
$('.banner-circle li').eq(page-1).addClass('selected')
.siblings().removeClass('selected');
}
$banner.mouseover(function(){
$btn.css({'display':'block'});
clearInterval(timer);
}).mouseout(function(){
$btn.css({'display':'none'});
clearInterval(timer);
timer=setInterval(move,3000);
}).trigger("mouseout");//激活自動(dòng)播放
$btn_a.mouseover(function(){
//實(shí)現(xiàn)透明漸變,阻止冒泡
$(this).animate({opacity:0.6},'fast');
$btn.css({'display':'block'});
return false;
}).mouseleave(function(){
$(this).animate({opacity:0.3},'fast');
$btn.css({'display':'none'});
return false;
}).click(function(){
//手動(dòng)點(diǎn)擊清除計(jì)時(shí)器
btnClass=this.className;
clearInterval(timer);
timer=setInterval(move,3000);
move($(this),this.className);
});
$('.banner-circle li').live('click',function(){
var index=$('.banner-circle li').index(this);
$banner_ul.animate({left:-v_width*index},'slow');
page=index+1;
cirMove();
});
});
</script>
</head>
<body>
<div align="center" style="width:516px; margin:0 auto">
<div class="banner">
<div class="banner-btn">
<a href="javascript:;" class="prevBtn"><i></i></a>
<a href="javascript:;" class="nextBtn"><i></i></a>
</div>
<ul class="banner-img">
<li><a href="#"><img src="images/T1B1JYFCpdXXazuKP7-520-280.jpg"></a></li>
<li><a href="#"><img src="images/T16YtiFE4aXXb1upjX.jpg"></a></li>
<li><a href="#"><img src="images/T1Oi0oFrFkXXb1upjX.jpg"></a></li>
<li><a href="#"><img src="images/T1LtlPFppjXXb1upjX.jpg"></a></li>
<li><a href="#"><img src="images/T1GGJWFvpgXXazuKP7-520-280.jpg"></a></li>
<li><a href="#"><img src="images/T104hZFBVdXXazuKP7-520-280.jpg"></a></li>
</ul>
<ul class="banner-circle"></ul>
</div>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>
精彩專題分享:jQuery圖片輪播 JavaScript圖片輪播 Bootstrap圖片輪播
以上就是為大家分享的jQuery超精致圖片輪播幻燈片特效代碼,希望大家可以喜歡,并應(yīng)用到實(shí)踐中。
- 12款經(jīng)典的白富美型—jquery圖片輪播插件—前端開(kāi)發(fā)必備
- 基于JQuery的實(shí)現(xiàn)圖片輪播效果(焦點(diǎn)圖)
- jQuery圖片輪播的具體實(shí)現(xiàn)
- 原生js和jquery實(shí)現(xiàn)圖片輪播特效
- Jquery代碼實(shí)現(xiàn)圖片輪播效果(一)
- 基于jquery的圖片輪播 tab切換組件
- 原生js和jquery實(shí)現(xiàn)圖片輪播淡入淡出效果
- jquery圖片輪播插件仿支付寶2013版全屏圖片幻燈片
- jQuery制作簡(jiǎn)潔的圖片輪播效果
- jQuery手動(dòng)點(diǎn)擊實(shí)現(xiàn)圖片輪播特效
- 簡(jiǎn)單的jQuery banner圖片輪播實(shí)例代碼
- jQuery動(dòng)畫(huà)效果圖片輪播特效
- jQuery實(shí)現(xiàn)圖片輪播效果代碼(基于jquery.pack.js插件)
相關(guān)文章
基于jquery實(shí)現(xiàn)省市區(qū)三級(jí)聯(lián)動(dòng)效果
這篇文章主要介紹了基于jquery實(shí)現(xiàn)省市區(qū)三級(jí)聯(lián)動(dòng)效果,需要的朋友可以參考下2015-12-12
jQuery文本框(input textare)事件綁定方法教程
jquery​的事件綁定已經(jīng)用on替換了原來(lái)的bind,接下來(lái)為大家分享下bind的使用方法及input textare事件2013-04-04
jQuery實(shí)現(xiàn)用戶輸入自動(dòng)完成功能
本文介紹了jQuery實(shí)現(xiàn)用戶輸入自動(dòng)完成功能的方法。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-02-02
JQuery實(shí)現(xiàn)動(dòng)態(tài)表格點(diǎn)擊按鈕表格增加一行
動(dòng)態(tài)表格,功能為點(diǎn)擊添加按鈕,表格增加一行并給其name屬性賦予的值,點(diǎn)擊刪除,自動(dòng)刪除這一行,具體實(shí)現(xiàn)如下2014-08-08
用JQuery實(shí)現(xiàn)表格隔行變色和突出顯示當(dāng)前行的代碼
用JQuery實(shí)現(xiàn)表格隔行變色和突出顯示當(dāng)前行的代碼,需要的朋友可以參考下2012-02-02
jquery實(shí)現(xiàn)自定義樹(shù)形表格的方法【自定義樹(shù)形結(jié)構(gòu)table】
JQuery擴(kuò)展插件Validate 1 基本使用方法并打包下載

