www.gusucode.com > 数码公司网站源码程序 > 数码公司网站源码程序/product/js/productshift_dolphin.js
var divnum=0; $(document).ready(function() { var firstDiv = $("div[id^='product_shift_out_']").eq(divnum).attr("id"); divnum = divnum+1; var firstid = firstDiv.substr(18); var firstdiv = "div#product_shift_"+firstid; var outdiv = "div#product_shift_out_"+firstid; $(firstdiv).show(); var fnname = "productshif"+firstid; var func="$()."+fnname+"()"; setInterval(func, 4000); (function($){ $.fn[fnname] = function(){ var rollobj=$(outdiv).find(".product_shift"); var rolltotal=parseInt(rollobj.size()); var lastId=rolltotal+parseInt(firstid)-1; var nextId,nowId; $(outdiv).find(".product_shift").each(function(){ if(this.style.display=='block' || this.style.display=='inline'){ nowId=parseInt(this.id.substr(14)); if(nowId>=lastId){ nextId=firstid; }else{ nextId=nowId+1; } } }); $("div#product_shift_"+nextId).fadeIn('slow').show('slow'); $("div#product_shift_"+nowId).fadeOut('slow').hide(); }; })(jQuery); });