<\/a>');
if(o.focus) $this.append('<\/div>');
var $btn = $(".yx-rotaion-btn span"),$title = $(".yx-rotation-t"),$title_bg = $(".yx-rotation-title"),$focus = $(".yx-rotation-focus");
//如果自动播放,设置定时器
if(o.auto) var t = setInterval(function(){$btn.last().click()},o.during);
$title.text($dd.first().find("img").attr("alt")); $title.attr("href",$dd.first().find("a").attr("href")); // 输出焦点按钮
for(i=1;i<=dd_count;i++){
$focus.append(''+i+'');
}
// 兼容IE6透明图片 if($.browser.msie && $.browser.version == "6.0" ){
$btn.add($focus.children("span")).css({backgroundImage:'url(images/ico.gif)'});
} var $f = $focus.children("span");
$f.first().addClass("hover");
// 鼠标覆盖左右按钮设置透明度
$btn.hover(function(){
$(this).addClass("hover");
},function(){
$(this).removeClass("hover");
});
//鼠标覆盖元素,清除计时器
$btn.add($dd).add($f).hover(function(){
if(t) clearInterval(t);
},function(){
if(o.auto) t = setInterval(function(){$btn.last().click()},o.during);
});
//鼠标覆盖焦点按钮效果
$f.bind("mouseover",function(){
var i = $(this).index();
$(this).addClass("hover");
$focus.children("span").not($(this)).removeClass("hover");
$dd.eq(i).fadeIn(300);
$dd.not($dd.eq(i)).fadeOut(300); $title.text($dd.eq(i).find("img").attr("alt"));
curr_index = i;
});
//鼠标点击左右按钮效果
$btn.bind("click",function(){
$(this).index() == 1?curr_index++:curr_index--;
if(curr_index >= dd_count) curr_index = 0;
if(curr_index < 0) curr_index = dd_count-1;
$dd.eq(curr_index).fadeIn(300);
$dd.not($dd.eq(curr_index)).fadeOut(300); $f.eq(curr_index).addClass("hover");
$f.not($f.eq(curr_index)).removeClass("hover");
$title.text($dd.eq(curr_index).find("img").attr("alt"));
$title.attr("href",$dd.eq(curr_index).find("a").attr("href")); });
}); } });})(jQuery);
$.fn.imgtransition = function(o){
var defaults = {
speed : 5000,
animate : 1000
};
o = $.extend(defaults, o);
return this.each(function(){
var arr_e = $("dd", this);
arr_e.css({position: "absolute"});
arr_e.parent().css({margin: "0", padding: "0", "list-style": "none", overflow: "hidden"});
function shownext(){
var active = arr_e.filter(".active").length ? arr_e.filter(".active") : arr_e.first();
var next = active.next().length ? active.next() : arr_e.first();
active.css({"z-index": 9});
next.css({opacity: 0.0, "z-index": 10}).addClass('active').animate({opacity: 1.0}, o.animate, function(){
active.removeClass('active').css({"z-index": 8});
});
}
arr_e.first().css({"z-index": 9});
setInterval(function(){
shownext();
},o.speed);
});
};
$(document).ready(function(){
$('.img').imgtransition({
speed:3000, //图片切换时间
animate:1000 //图片切换过渡时间
});
});