您的位置:首页 > Web前端 > JavaScript

比较炫的图片播放器 js 焦点效果代码

2008-07-18 00:00 851 查看
图片播放器_图片轮换_焦点效果

#focus_m{position:relative; width:420px; height:384px; background:#133775}
.f_img_roll{width:350px; height:300px; position:relative;}
.f_img_roll img{position:absolute; left:0; top:0; width:350px; height:300px;}
.f_img_tree{position:absolute; width:75px; height:300px; right:3px; top:0;}
.f_img_tree div{position:absolute; z-index:201; top:3px; right:0; width:75px; height:47px; background:url(http://www.kuanghong.com/han/images/mask.gif) no-repeat;}
.f_img_tree ul{margin:0; padding:0; list-style:none; position:absolute; right:0;}
.f_img_tree li{width:60px; height:45px; border:1px solid #0066cc; margin-top:3px;}
.f_img_tree img{width:54px; height:39px; border:3px solid #000066; vertical-align:top;}
.f_con{color:#fff; height:70px;}
.f_con .f_title{font-size:14px; height:30px; line-height:30px; margin-top:5px; font-weight:bold; text-align:center;}
.f_con .f_title a:link, .f_con .f_title a:visited{color:#fff; text-decoration:none}
.f_con .f_title a:hover{text-decoration:underline}
.f_con .f_con{font-size:12px; padding:0 10px; height:40px; line-height:150%;}


function $A(iterable) {
var results = [];
for (var i = 0; i < iterable.length; i++)results.push(iterable[i]);
return results;
}
Function.prototype.bind = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
var imgs = [
{max:'http://www.kuanghong.com/han/images/img_1.jpg', min:'http://www.kuanghong.com/han/images/img_1s.jpg', url:'#', title:'标题01标题01标题01标题01标题01', con:'内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01内容01'},
{max:'http://www.kuanghong.com/han/images/img_2.jpg', min:'http://www.kuanghong.com/han/images/img_2s.jpg', url:'#', title:'标题02标题02标题02标题02标题02', con:'内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02内容02'},
{max:'http://www.kuanghong.com/han/images/img_3.jpg', min:'http://www.kuanghong.com/han/images/img_3s.jpg', url:'#', title:'标题03标题03标题03标题03标题03', con:'内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03内容03'},
{max:'http://www.kuanghong.com/han/images/img_4.jpg', min:'http://www.kuanghong.com/han/images/img_4s.jpg', url:'#', title:'标题04标题04标题04标题04标题04', con:'内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04内容04'},
{max:'http://www.kuanghong.com/han/images/img_5.jpg', min:'http://www.kuanghong.com/han/images/img_5s.jpg', url:'#', title:'标题05标题05标题05标题05标题05', con:'内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05内容05'},
{max:'http://www.kuanghong.com/han/images/img_6.jpg', min:'http://www.kuanghong.com/han/images/img_6s.jpg', url:'#', title:'标题06标题06标题06标题06标题06', con:'内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06内容06'}
];
function focus(){this.initialize.apply(this,arguments)}
focus.prototype = {
initialize: function(imgs, fc, tim, speed){
this.imgs = imgs;
this.tim = tim*1000 || 2000;
this.speed = speed || 0.3;
this.t = null; // 动作计时
this.tm = null; // 图片计时
this.tb = null; // 滑块儿计时
this.cur_i = 0; // 当前图片位置
this.move = false; // 是否在运动
this.tem = 0; // 临时数据
this.posTo = 0; // 滑块儿目的地
this.over = 0;
var ds = document.getElementById(fc).getElementsByTagName('div');
var di = ds[0];
this.img_m = document.createElement('img');
this.img_m2 = this.img_m.cloneNode(true);
var dm = ds[1];
this.title = ds[3];
this.con = ds[4];
this.mask = document.createElement('div');
this.ul = document.createElement('ul');
this.lis = [];
this.img_m.style.zIndex = 101;
this.img_m2.style.zIndex = 100;
di.appendChild(this.img_m);
di.appendChild(this.img_m2);
di = null;
dm.appendChild(this.mask);
dm.appendChild(this.ul);
dm = null;
this.img_cache();
this.load();
},
img_cache: function(){
var img = new Image();
for(var i=0; i
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: