; (function ($) {
/* var i = 2;
$(document).ready(function () {
var arry = ['images/headback/001.jpg', 'images/headback/002.jpg', 'images/headback/003.jpg', 'images/headback/004.jpg', 'images/headback/005.jpg', 'images/headback/006.jpg', ]
setInterval(
function () {
$("#div_pic").css("backgroundImage", "url(" + arry[i] + ")");
i++;
if (i == 5) {
i = 0;
}
}
, 5000);
}); å®æ¶æ¢èæ¯å¾çç代ç */
//ä¸é¢æ¯å¾çåæ¢ä»£ç
/*
var t;
var speed = 2; //å¾çåæ¢é度
var nowlan = 0; //å¾çå¼å§æ¶é´
function changepic() {
var imglen = $("#div_pic").find("li").length;
$("#div_pic").find("li").hide();
$("#div_pic").find("li").eq(nowlan).show();
nowlan = nowlan + 1 == imglen ? 0 : nowlan + 1;
t = setTimeout("changepic()", speed * 1000);
}
onload = function () { changepic(); }
$(document).ready(function ()
//é¼ æ å¨å¾çä¸æ¬å让åæ¢æå
$("#div_pic").hover(function () { clearInterval(t); });
//é¼ æ 离å¼å¾çåæ¢ç»§ç»
$("#div_pic").mouseleave(function () { changepic(); });
});
*/
//ä¸é¢æ¯å¾çè½®æ代ç
/* var num = 0
$(function(){
$("#div_pic ol li").mouseover(function(e){
$(this).attr("class","current");
$(this).siblings().attr("class",""); //å
å¼èç¹çclasså±æ§è®¾ç½®ä¸ºç©º
//alert($('ul').index())
num = $('ul').index() + 2
var index = $(this).index(); //è®°å½éå®çliæ ç¾å¨ulä¸çç´¢å¼
//å¾çä¼åºç°å±å ç°è±¡ä¸ºäºæ¾ç¤ºå½åçå¾çï¼æå½åçå¾ççz-index å¼è®¾ç½®ä¸ºå¤§äºå
¶ä»çå
å¼å
ç´
$("#div_pic ul li").eq(index).css({"left":"650px","zIndex":num})
$("#div_pic ul li").eq(index).siblings().css("zIndex",num-1);
//å¨ç»ææï¼å¾çä»å³ä¾§é£å
¥
$("#div_pic ul li").eq(index).animate({left:"0"},500)
});
}); */
//ä¸é¢æ¯å¯é
置轮æå¨ç»ä»£ç
$.fn.slide=function(options){
var defaults= {
affect:1, //1ï¼ä¸ä¸æ»å¨; 2:å¹å¸å¼; 3:å·¦å³æ»å¨ï¼4ï¼æ·¡å
¥æ·¡åº
time: 5000, //é´éæ¶é´
speed:500, //å¨ç»å¿«æ
¢
dot_text:true,//æé®ä¸ææ åºåå·
};
var opts=$.extend(defaults,options);
var $this=$(this);
var ool=$("<div class='dot'><p></p></div>");
var $box=$this.find("ul");
var $li=$box.find("li");
var timer=null;
var num=0;
$this.append(ool);
$box.find("li").each(function(i){
ool.find("p").append($("<b></b>"));
if(opts.dot_text){
ool.find("b").eq(i).html(i+1)
}
})
ool.find("b").eq(0).addClass("cur");
switch(opts.affect){
case 1:
break;
case 2:
$box.find("li").css("display","none");
break;
case 3:
$box.css({"width":$li.eq(0).width()*$li.length});
$li.css("float","left");
break;
case 4:
$box.find("li").css("display","none");
break;
}
$box.find("li").eq(0).show(0);
ool.find("b").mouseover(function(){
num=$(this).index();
run ();
})
timer=setInterval(auto,opts.time);
function auto(){
num<$box.find("li").length-1?num++:num=0;
run();
}
function run(){
ool.find("b").eq(num).addClass("cur").siblings().removeClass("cur");
switch(opts.affect){
case 1:
$box.stop(true,false).animate({"top":-240*num},opts.speed);
break;
case 2:
$box.find("li").css({"position":"absolute"});
$box.find("li").stop(false,true).fadeOut(opts.speed).eq(num).slideDown(opts.speed);
break;
case 3:
$box.stop(true,false).animate({"left":-670*num},opts.speed);
break;
case 4:
$box.find("li").css({"position":"absolute"});
$box.find("li").stop(false,true).fadeOut(opts.speed).eq(num).fadeIn(opts.speed);
break;
}
}
$this.mouseover(function(){
clearInterval(timer);
})
$this.mouseout(function(){
timer=setInterval(auto,opts.time);
})
}
}(jQuery));
温馨提示:内容为网友见解,仅供参考