jQuery實(shí)現(xiàn)圖片簡單輪播功能示例
本文實(shí)例講述了jQuery實(shí)現(xiàn)圖片簡單輪播功能。分享給大家供大家參考,具體如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>www.dbjr.com.cn jQuery圖片輪播</title>
<style type="text/css">
#frame{
width:700px;
height:300px;
position:relative;
}
#img2,#img3{
display:none;
}
.box{
position:absolute;
width:50px;
height:50px;
line-height:50px;
text-align:center;
color:white;
font-family:Microsoft-Yahei;
background:grey;
}
#move1{
bottom:0;
right:100px;
}
#move2{
bottom:0;
right:50px;
}
#move3{
bottom:0;
right:0;
}
</style>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
n = 1;
interval = setInterval(
function(){
$("img").hide();
$("#img"+n).show();
$(".box").css("background","grey");
$("#move"+n).css("background","red");
n = n % 3 + 1;
}
,
2000
);
$(".box").bind("click",function() {
clearInterval(interval);
n = $(this).attr("id").slice(4);
interval = setInterval(
function(){
$("img").hide();
$("#img"+n).show();
$(".box").css("background","grey");
$("#move"+n).css("background","red");
n = n % 3 + 1;
}
,
2000
);
});
});
</script>
</head>
<body>
<div id="frame">
<div id="photos">
<img id="img1" src="images/background1.png">
<img id="img2" src="images/background2.png">
<img id="img3" src="images/background3.png">
</div>
<div class="box" id="move1">1</div>
<div class="box" id="move2">2</div>
<div class="box" id="move3">3</div>
</div>
</body>
</html>
感興趣的朋友可以使用在線HTML/CSS/JavaScript代碼運(yùn)行工具:http://tools.jb51.net/code/HtmlJsRun 測試運(yùn)行效果(記得替換上述圖片為網(wǎng)絡(luò)圖片)
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery圖片操作技巧大全》、《jQuery表格(table)操作技巧匯總》、《jQuery切換特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery常見經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
- 原生js和jquery實(shí)現(xiàn)圖片輪播淡入淡出效果
- 基于jQuery實(shí)現(xiàn)淡入淡出效果輪播圖
- 原生js和jQuery實(shí)現(xiàn)淡入淡出輪播效果
- jQuery實(shí)現(xiàn)的簡單圖片輪播效果完整示例
- 使用JQuery實(shí)現(xiàn)圖片輪播效果的實(shí)例(推薦)
- 純javaScript、jQuery實(shí)現(xiàn)個性化圖片輪播【推薦】
- jQuery簡單自定義圖片輪播插件及用法示例
- jQuery實(shí)現(xiàn)的圖片輪播效果完整示例
- jQuery的圖片輪播插件PgwSlideshow使用詳解
- jQuery實(shí)現(xiàn)圖片輪播效果代碼(基于jquery.pack.js插件)
- jQuery實(shí)現(xiàn)的淡入淡出圖片輪播效果示例
相關(guān)文章
jquery ajax實(shí)現(xiàn)下拉框三級無刷新聯(lián)動,且保存保持選中值狀態(tài)
jquery ajax實(shí)現(xiàn)下拉框三級無刷新聯(lián)動,且保存保持選中值狀態(tài)。需要的朋友可以過來參考下,希望對大家有所幫助2013-10-10
使用jQuery實(shí)現(xiàn)鼠標(biāo)點(diǎn)擊左右按鈕滑動切換
在做web前端開發(fā)的時候經(jīng)常遇到圖片滑動切換特效,接下來通過本文給大家分享使用jQuery實(shí)現(xiàn)鼠標(biāo)點(diǎn)擊左右按鈕滑動切換特效,感興趣的朋友參考實(shí)現(xiàn)代碼2017-08-08
jQuery實(shí)現(xiàn)滾動切換的tab選項(xiàng)卡效果代碼
這篇文章主要介紹了jQuery實(shí)現(xiàn)滾動切換的tab選項(xiàng)卡效果代碼,涉及jquery鏈?zhǔn)讲僮骷皹邮絼討B(tài)操作的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-08-08
jquery實(shí)現(xiàn)九宮格大轉(zhuǎn)盤抽獎
jQuery九宮格大轉(zhuǎn)盤抽獎代碼網(wǎng)頁特效,點(diǎn)擊抽獎按鈕開始隨機(jī)抽獎選擇獎品,可設(shè)置起點(diǎn)位置、獎品數(shù)量、轉(zhuǎn)動次數(shù)、中獎位置參數(shù)2015-11-11
jQuery插件ajaxFileUpload使用實(shí)例解析
這篇文章主要為大家詳細(xì)介紹了jQuery插件ajaxFileUpload使用實(shí)例,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-10-10
jQuery中ajax的相關(guān)知識點(diǎn)匯總
這篇文章主要給大家介紹了關(guān)于jQuery中ajax相關(guān)知識點(diǎn)的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03

