店铺在自定义模板设置全屏轮播
pic player < type="text/java" src="http://img.jb51.net/jslib/jquery/jquery-1.2.6.js">> there is a pic-player
<> var p = $(#picplayer); var pics1 = [{url:,link:,time:5000},{url:,link:,time:4000},{url:,link:,time:6000},{url:,link:,time:6000},{url:,link:,time:6000}]; //url:图片地址i link:图片链接 initPicPlayer(pics1,p.css(width).split(px)[0],p.css(height).split(px)[0]); // // function initPicPlayer(pics,w,h) { //选中的图片 var selectedItem; //选中的按钮 var selectedBtn; //自动播放的id var playID; //选中图片的索引 var selectedIndex; //容器 var p = $(#picplayer); p.text(); p.append(); var c = $(#piccontent); for(var i=0;i { //添加图片到容器中 c.append(); } //按钮容器,绝对定位在右下角 p.append(); // var btnHolder = $(#picbtnHolder); btnHolder.append(); var btns = $(#picbtns); // for(var i=0;i { //增加图片对应的按钮 btns.append( +(i+1)+ ); $(#picbtn+i).data(index,i); $(#picbtn+i).click( function(event) { if(selectedItem.attr(src) == $(#picitem+$(this).data(index)).attr(src)) { return; } setSelectedItem($(this).data(index)); } ); } btns.append( ); /// setSelectedItem(0); //显示指定的图片index function setSelectedItem(index) { selectedIndex = index; clearInterval(playID); //alert(index); if(selectedItem)selectedItem.fadeOut(fast); selectedItem = $(#picitem+index); selectedItem.fadeIn(slow); // if(selectedBtn) { selectedBtn.css(backgroundColor,#eee); selectedBtn.css(color,#000); } selectedBtn = $(#picbtn+index); selectedBtn.css(backgroundColor,#000); selectedBtn.css(color,#fff); //自动播放 playID = setInterval(function() { var index = selectedIndex+1; if(index > pics.length-1)index=0; setSelectedItem(index); },pics[index].time); } } >