www.gusucode.com > 2016网博士成品网站管理系统 PHP网站源码程序 > 2016/product/js/productlist_2016.js

    
//图片切换
$(document).ready(function() {
	var pmdWidth=$("#productlist_2016")[0].offsetWidth;
	var pmdHeight=$("#productlist_2016")[0].offsetHeight;
	
	$("#productlist_2016").css({width:pmdWidth,height:pmdHeight,marginLeft:'0px'});
	$("#productlist_2016_1").css({marginLeft:'0px'});

	  var speed=20;
	  $("#productlist_2016_2").html($("#productlist_2016_1").html());
	  
	  function pmdMarquee(){
		var pmdMarginLeft=parseInt($("#productlist_2016_1")[0].style.marginLeft);
		if(pmdWidth+pmdMarginLeft<=0){
			$("#productlist_2016_1")[0].style.marginLeft="0px";
		}else{
			$("#productlist_2016_1")[0].style.marginLeft=pmdMarginLeft-1 + "px";
			//var pmdToLeft=pmdMarginLeft-1 + "px";
			//$("#productlist_2016_1").animate({marginLeft:pmdToLeft},'slow');
		}
	  }

	  var MyMar=setInterval(pmdMarquee,speed);
	  

	  $("#productlist_2016").mouseover(function(){
		  clearInterval(MyMar);
	  });
	  $("#productlist_2016").mouseout(function(){
		  MyMar=setInterval(pmdMarquee,speed);
	  });
	
});