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

js仿土豆網(wǎng)帶縮略圖的焦點(diǎn)圖片切換效果實(shí)現(xiàn)方法

 更新時(shí)間:2015年02月23日 11:45:19   作者:代碼家園  
這篇文章主要介紹了js仿土豆網(wǎng)帶縮略圖的焦點(diǎn)圖片切換效果實(shí)現(xiàn)方法,涉及javascript操作圖片特效的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了js仿土豆網(wǎng)帶縮略圖的焦點(diǎn)圖片切換效果實(shí)現(xiàn)方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>仿土豆網(wǎng)帶縮略圖的焦點(diǎn)圖片切換效果</title>
<style type="text/css">
/* Reset style */
* { margin:0; padding:0; word-break:break-all; }
body { background:#FFF; color:#333; font:12px/1.6em Helvetica, Arial, sans-serif; }
h1, h2, h3, h4, h5, h6 { font-size:1em; }
a { color:#039; text-decoration:none; }
a:hover { text-decoration:underline; }
ul, li { list-style:none; }
fieldset, img { border:none; }
em, strong, cite, th { font-style:normal; font-weight:normal; }
/* Focus_change style */
#focus_change { position:relative; width:450px; height:295px; overflow:hidden; margin:20px 0 1px 60px; }
#focus_change_list { position:absolute; width:1800px; height:295px; }
#focus_change_list li { float:left; }
#focus_change_list li img { width:450px; height:295px; }
.focus_change_opacity { position:absolute; width:450px; height:70px; top:225px; left:0; background:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
#focus_change_btn { position:absolute; width:450px; height:65px; top:225px; left:0; }
#focus_change_btn ul { padding-left:5px; }
#focus_change_btn li { display:inline; float:left; margin:0 15px; padding-top:12px; }
#focus_change_btn li img { width:76px; height:50px; border:2px solid #888; }
#focus_change_btn .current { background:url(/uploadfile/200901/1/6C164133877.gif) no-repeat 37px 8px;}
#focus_change_btn .current img { border-color:#EEE; }
</style>
<script type="text/javascript">
function $(id) { return document.getElementById(id); }
function moveElement(elementID,final_x,final_y,interval) {
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval);
}
function classNormal(){
var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
for(var i=0; i<focusBtnList.length; i++) {
focusBtnList[i].className='';
}
}
function focusChange() {
var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
focusBtnList[0].onmouseover = function() {
moveElement('focus_change_list',0,0,5);
classNormal()
focusBtnList[0].className='current'
}
focusBtnList[1].onmouseover = function() {
moveElement('focus_change_list',-450,0,5);
classNormal()
focusBtnList[1].className='current'
}
focusBtnList[2].onmouseover = function() {
moveElement('focus_change_list',-900,0,5);
classNormal()
focusBtnList[2].className='current'
}
focusBtnList[3].onmouseover = function() {
moveElement('focus_change_list',-1350,0,5);
classNormal()
focusBtnList[3].className='current'
}
}
setInterval('autoFocusChange()', 5000);
var atuokey = false;
function autoFocusChange() {
$('focus_change').onmouseover = function(){atuokey = true}
$('focus_change').onmouseout = function(){atuokey = false}
if(atuokey) return;
var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
for(var i=0; i<focusBtnList.length; i++) {
if (focusBtnList[i].className == 'current') {
var currentNum = i;
}
}
if (currentNum==0 ){
moveElement('focus_change_list',-450,0,5);
classNormal()
focusBtnList[1].className='current'
}
if (currentNum==1 ){
moveElement('focus_change_list',-900,0,5);
classNormal()
focusBtnList[2].className='current'
}
if (currentNum==2 ){
moveElement('focus_change_list',-1350,0,5);
classNormal()
focusBtnList[3].className='current'
}
if (currentNum==3 ){
moveElement('focus_change_list',0,0,5);
classNormal()
focusBtnList[0].className='current'
}
}
window.onload=function(){
focusChange();
}
</script>
</head>
<body>
<div id="focus_change">
<div id="focus_change_list" style="top:0; left:0;">
<ul>
<li><a href="http://www.fzitv.net/"><img src="/images/m03.jpg" alt="" /></a></li>
<li><a href="http://www.fzitv.net/"><img src="/images/m04.jpg" alt="" /></a></li>
<li><a href="http://www.fzitv.net/"><img src="/images/m09.jpg" alt="" /></a></li>
<li><a href="http://www.fzitv.net/"><img src="/images/m10.jpg" alt="" /></a></li>
</ul>
</div>
<div class="focus_change_opacity"></div>
<div id="focus_change_btn">
<ul>
<li class="current"><a href="#"><img src="/images/s3.jpg" alt="" /></a></li>
<li><a href="#"><img src="/images/s4.jpg" alt="" /></a></li>
<li><a href="#"><img src="/images/s9.jpg" alt="" /></a></li>
<li><a href="#"><img src="/images/s10.jpg" alt="" /></a></li>
</ul>
</div>
</div><!--focus_change end-->
<div style="height:20px; background:#EEE;"></div>
</body>
</html>

希望本文所述對大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • JavaScript中內(nèi)存泄漏的介紹與教程(推薦)

    JavaScript中內(nèi)存泄漏的介紹與教程(推薦)

    內(nèi)存泄露是指一塊被分配的內(nèi)存既不能使用,又不能回收,直到瀏覽器進(jìn)程結(jié)束。下面這篇文章主要給的大家介紹了關(guān)于JavaScript中內(nèi)存泄漏的相關(guān)資料,文中介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧。
    2017-06-06
  • javascript addBookmark 加入收藏 多瀏覽器兼容

    javascript addBookmark 加入收藏 多瀏覽器兼容

    不錯的加入收藏代碼,加入了對一些常見瀏覽器的判斷,更好的體現(xiàn)用戶體驗(yàn),兼容了ie,firefox.
    2009-08-08
  • JavaScript實(shí)現(xiàn)創(chuàng)建自定義對象的常用方式總結(jié)

    JavaScript實(shí)現(xiàn)創(chuàng)建自定義對象的常用方式總結(jié)

    這篇文章主要介紹了JavaScript實(shí)現(xiàn)創(chuàng)建自定義對象的常用方式,結(jié)合實(shí)例形式總結(jié)分析了JavaScript工廠模式、構(gòu)造函數(shù)模式、原型模式、組合模式等常用的自定義對象創(chuàng)建模式操作與使用技巧,需要的朋友可以參考下
    2018-07-07
  • js 數(shù)值轉(zhuǎn)換為3位逗號分隔的示例代碼

    js 數(shù)值轉(zhuǎn)換為3位逗號分隔的示例代碼

    本篇文章主要是對js將數(shù)值轉(zhuǎn)換為3位逗號分隔的示例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2014-02-02
  • 原生js實(shí)現(xiàn)分頁效果

    原生js實(shí)現(xiàn)分頁效果

    這篇文章主要為大家詳細(xì)介紹了原生js實(shí)現(xiàn)分頁效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-09-09
  • 寫出更好的JavaScript程序之undefined篇(中)

    寫出更好的JavaScript程序之undefined篇(中)

    前一篇我介紹了幾種廣為使用的利用undefined這個概念值的辦法,這一篇我會介紹一些不太常見的辦法,其中還包括一個很巧妙的,我個人覺得很值得推廣的辦法。
    2009-11-11
  • JavaScript中展開運(yùn)算符及應(yīng)用的實(shí)例代碼

    JavaScript中展開運(yùn)算符及應(yīng)用的實(shí)例代碼

    這篇文章主要介紹了JavaScript中展開運(yùn)算符及應(yīng)用的實(shí)例代碼,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-01-01
  • 使用JavaScript實(shí)現(xiàn)輪播圖特效

    使用JavaScript實(shí)現(xiàn)輪播圖特效

    這篇文章主要為大家詳細(xì)介紹了使用JavaScript實(shí)現(xiàn)輪播圖特效,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • js 原型對象和原型鏈理解

    js 原型對象和原型鏈理解

    本文主要介紹了js原型對象和原型鏈的相關(guān)知識。具有很好的參考價(jià)值,下面跟著小編一起來看下吧
    2017-02-02
  • 探討js中的雙感嘆號判斷

    探討js中的雙感嘆號判斷

    js中的雙感嘆號判斷。在網(wǎng)上查了些資料,他相當(dāng)于三元運(yùn)算符,返回boolean值
    2013-11-11

最新評論

阿尔山市| 信丰县| 七台河市| 肃宁县| 福安市| 连云港市| 锡林浩特市| 鞍山市| 调兵山市| 盐边县| 义马市| 德令哈市| 会同县| 武功县| 铜鼓县| 扬中市| 遵义市| 连南| 金川县| 平山县| 新邵县| 库尔勒市| 东宁县| 盘山县| 松原市| 阿拉善右旗| 含山县| 杨浦区| 准格尔旗| 乐亭县| 石屏县| 富宁县| 麟游县| 永川市| 资阳市| 神农架林区| 山西省| 治多县| 江油市| 会同县| 和顺县|