+ -
当前位置:首页 → 问答吧 → 图片..

图片..

时间:2010-05-11

来源:互联网


<!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> <title> new document </title> <meta contentType="text/html" charset="utf-8"/> <style> *{margin:0; padding:0; font-weight:normal;} div{width:650px; height:340px; border:1px solid silver;position:relative;} #loader{width:630px; height:320px; margin:10px;} #arr1, #arr2{display:block; position:absolute; width:75px; height:50px; top:125px; border:1px solid green; z-index:99;} #arr1{left:20px;} #arr2{right:20px;} </style> </head> <body> <div> <img id='loader' src='http://list.image.baidu.com/t/image_category/res/qiche/Ao_Di.jpg' /> <a id='arr1' href='#'>&nbsp;</a> <a id='arr2' href='#'>&nbsp;</a> </div> <script> void function(){ function $(d){ return document.getElementById(d)} function A(d){ $(d).fade = function(y, d, fn){ var t = 0, b = y, c = [1,-1][y], T = this, d = d||10, s = T.style, clear = clearInterval, C = function(t, b, c, d) { return -c * (t /= d) * (t - 2) + b }; T.timer && clear(T.timer) T.timer = setInterval(function(){ !+[1,] ? s.filter = 'alpha(opacity=' + C(t, b, c, d)*100 + ')' : s.opacity = C(t, b, c, d); ++t == d && (clear(T.timer), fn&&fn.call(T), t=0); }, d); }; $(d).run = function(y, s, _s){this.src = s;this.fade(y, _s||100)}; return $(d); } var pics = [ 'http://list.image.baidu.com/t/image_category/res/qiche/Ao_Di.jpg', 'http://list.image.baidu.com/t/image_category/res/qiche/Bao_Ma.jpg', 'http://list.image.baidu.com/t/image_category/res/qiche/Bao_Shi_Jie.jpg', 'http://list.image.baidu.com/t/image_category/res/qiche/Ben_Chi.jpg' ], cur=0, speed = 50; $('arr1').onclick = $('arr2').onclick = function(){ var add = this.id == 'arr1' ? -1 : 1, len = pics.length; cur += add; A('loader').run(0, pics[cur >= len ? 0 : cur < 0 ? len-1 : cur], speed); } }() </script> </body> </html>
 提示:您可以先修改部分代码再运行

作者: forbe   发布时间: 2010-05-11