// JavaScript Document
;(function($){
$.fn.extend({
"zj_ppt":function(value){
//Default parameter definition
var $this = $(this);
value = $ .extend({
"time":2000, //Interval change animation time
"con":0,
"sto":true,
"count":"count", // Switch the parent class name of the small picture
"src":"src", //Switch the small picture path
"src_cur":"src_cur" //Current switching small picture path
}, value);
//Picture switching function
function autopic(){
$("li",$this[0]).hide();
$("li:eq(" value.con ")",$this[0]).show();
$(value.count).find("ul li img").attr("src",value.src);
$(value.count).find("ul li img:eq(" value.con ")").attr("src",value.src_cur);
if(value.con>$("li ",$this[0]).length-2){
value.con = 0;
}else{
value.con = 1;
}
}
//How often to perform picture switching
function sett(){
if(value.sto){autopic()};
setTimeout(sett,value.time);
}
//Switch the image when the mouse is hovering, and stop automatic switching
$(value.count).find("ul li").hover(function(){
var _index = $(this).index();
value.con = _index;
value.sto = false;
autopic();
},function(){
var _index = $ (this).index();
value.sto = true;
value.con = _index;
});
sett();
//Return the original object to connect to other JQuery methods
return $this;
}
});
})(jQuery);
The above is part of the plug-in code;
You can download the demo below
/201205/yuanma/myPPT_jb51.rar