最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Javascript Web Slider 焦點(diǎn)圖示例源碼

 更新時(shí)間:2013年10月10日 16:40:29   作者:  
Slider 焦點(diǎn)圖會(huì)在很多的網(wǎng)站上見(jiàn)到,在本文為大家詳細(xì)介紹下具體的實(shí)現(xiàn)過(guò)程,下面的源碼大家可以運(yùn)行下
HTML代碼:
復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
*{padding:0;margin:0}
ul{list-style:none}
.slider-focus{width:670px;height:240px;overflow:hidden;position:relative;margin:100px auto}
.slider-focus .slider{width:3500px; position:absolute; left:0px; top:0px; height:240px}
.slider-focus .slider li{float:left;}
.slider-focus .btns{position: absolute; right: 0px; bottom: 5px}
.slider-focus .btns li{width:18px;height:18px; float:left; background:#fff; margin-right:5px; cursor:pointer}
.slider-focus .btns li.cur{background:#f60}
</style>
</head>
<body>
<div class="slider-focus">
<ul class="slider">
<li><img src="http://img14.360buyimg.com/da/g13/M03/0D/0D/rBEhVFJCwIQIAAAAAADs5q4P0g8AADgxQMhvMIAAOz-234.jpg"></li>
<li><img src="http://img11.360buyimg.com/da/g13/M05/0D/0A/rBEhUlJCfiYIAAAAAADqWhDpUVsAADfqgDwmw4AAOpy960.jpg"></li>
<li><img src="http://img11.360buyimg.com/da/g14/M07/11/15/rBEhVVI_5zMIAAAAAADDgfSaKlQAADc8AFf20cAAMOZ670.jpg"></li>
<li><img src="http://img11.360buyimg.com/da/g13/M03/0D/13/rBEhVFJD_HcIAAAAAADsfenKOe0AADjVwPmryQAAOyV341.jpg"></li>
<li><img src="http://img14.360buyimg.com/da/g15/M00/0C/0E/rBEhWlJEHcwIAAAAAAEFI3XGv_YAADj-wC9W60AAQU7805.jpg"></li>
</ul>
<ul class="btns">
<li class="cur"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<script src="jquery-1.9.1.js"></script>
<script src="slider.js"></script>
</body>
</html>

Javasscript 代碼:
復(fù)制代碼 代碼如下:

function Sliderfocus(options){
this.focus = options.focus;
this.slider = options.slider;
this.btns = options.btns;
this.width = options.width;
this.speed = options.speed || 800;
this.curIndex = options.curIndex || 0;
this.size = this.btns.size();
this.init();
this.timeout = null;
this.stopTemp = 1 ;
}

Sliderfocus.prototype = {
init:function(){
this.auto();
this.bind();
},
play:function(){
this.slider.stop().animate({
left:-this.curIndex * this.width
},this.speed);
},
auto:function(){
var that = this;
this.timeout = setTimeout(function(){
if(that.stopTemp == 0){
return;
}else{
that.next();
that.auto();
}
},4000);
},
prev:function(){
this.curIndex = --this.curIndex<0? this.size-1 : this.curIndex;
this.play();
},
next:function(){
this.curIndex = ++this.curIndex>this.size-1? 0 : this.curIndex;
console.log(this.curIndex)
this.play();
},
stop:function(){
this.stopTemp = 0;
},
bind:function(){
var that = this;
this.focus.bind("mouseover",function(){
that.stop();
}).bind("mouseout",function(){
that.stopTemp = 1;
//that.auto();
});
this.letsgo();
},
letsgo:function(){
var that = this;
this.btns.bind("click",function(){
var index = $(this).index();
that.curIndex = index;
that.play();

});
}
};

new Sliderfocus({
focus:$(".slider-focus"),
slider:$(".slider-focus .slider"),
btns:$(".btns li"),
width:670
});

相關(guān)文章

  • JavaScript網(wǎng)頁(yè)表單form中禁止自動(dòng)提交的兩種方式

    JavaScript網(wǎng)頁(yè)表單form中禁止自動(dòng)提交的兩種方式

    本文是我本人在開(kāi)發(fā)網(wǎng)頁(yè)時(shí),在表單中加入了button按鈕,本來(lái)是用于jQuery點(diǎn)擊相應(yīng)事件的按鈕,然后,但我點(diǎn)擊button時(shí),發(fā)現(xiàn)不是達(dá)到j(luò)Query指定效果,所以在本文中,我們將討論網(wǎng)頁(yè)表單(form)中提交的兩種方式,需要的朋友可以參考下
    2024-06-06
  • js動(dòng)態(tài)添加帶圓圈序號(hào)列表的實(shí)例代碼

    js動(dòng)態(tài)添加帶圓圈序號(hào)列表的實(shí)例代碼

    這篇文章主要介紹了js動(dòng)態(tài)添加帶圓圈序號(hào)列表的實(shí)例代碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-02-02
  • Javascript基礎(chǔ)之?dāng)?shù)組的使用

    Javascript基礎(chǔ)之?dāng)?shù)組的使用

    這篇文章主要介紹了Javascript基礎(chǔ)之?dāng)?shù)組的使用的相關(guān)資料,介紹的非常詳解,具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧
    2016-05-05
  • JS Tween 顏色漸變

    JS Tween 顏色漸變

    從我寫(xiě)的as tween改寫(xiě)的,基本功能跟as里面寫(xiě)的一樣,只是沒(méi)有擴(kuò)展特定功能的接口(比如alpha2,move2,size2,color2等接口,這些在as tween里面都有實(shí)現(xiàn))。
    2008-12-12
  • 21個(gè)值得收藏的Javascript技巧

    21個(gè)值得收藏的Javascript技巧

    在本文中列出了21個(gè)值得收藏的Javascript技巧,在實(shí)際工作中,如果能適當(dāng)運(yùn)用,則大大提高工作效率
    2014-02-02
  • JavaScript 關(guān)于元素獲取焦點(diǎn)(隱藏元素與div)

    JavaScript 關(guān)于元素獲取焦點(diǎn)(隱藏元素與div)

    關(guān)于元素獲取焦點(diǎn)要注意2個(gè)小問(wèn)題,需要的朋友可以參考下。
    2011-01-01
  • GoJs分組繪圖模板go.Group使用示例詳解

    GoJs分組繪圖模板go.Group使用示例詳解

    這篇文章主要為大家介紹了GoJs分組繪圖模板go.Group使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-04-04
  • JS判斷字符串字節(jié)數(shù)并截取長(zhǎng)度的方法

    JS判斷字符串字節(jié)數(shù)并截取長(zhǎng)度的方法

    這篇文章主要介紹了JS判斷字符串字節(jié)數(shù)并截取長(zhǎng)度的方法,涉及JavaScript針對(duì)頁(yè)面元素與字符串的動(dòng)態(tài)操作技巧,需要的朋友可以參考下
    2016-03-03
  • 通過(guò)url查找a元素應(yīng)用案例

    通過(guò)url查找a元素應(yīng)用案例

    這篇文章主要介紹了通過(guò)url查找a元素的實(shí)現(xiàn)思路,解決一些比較實(shí)際的問(wèn)題,感興趣的朋友可以參考下
    2014-04-04
  • 淺談JavaScript中的parseInt()的妙用

    淺談JavaScript中的parseInt()的妙用

    本文主要介紹了JavaScript中的parseInt()的妙用,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-07-07

最新評(píng)論

格尔木市| 阿鲁科尔沁旗| 伊金霍洛旗| 余姚市| 晋宁县| 于田县| 乌拉特后旗| 镇赉县| 刚察县| 马公市| 卓尼县| 平武县| 弋阳县| 大厂| 东安县| 扬中市| 波密县| 新民市| 宜昌市| 漳州市| 德化县| 沂南县| 藁城市| 南召县| 吐鲁番市| 岑巩县| 资阳市| 金川县| 兴文县| 南宁市| 福海县| 十堰市| 会泽县| 拉孜县| 大渡口区| 湘潭市| 荔浦县| 淅川县| 大安市| 天峻县| 莱州市|