www.gusucode.com > 数码产品生产企业网站PHP源码程序 > 1010/product/js/productlist_pmd.js

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

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

	  var MyMar=setInterval(pmdMarquee,speed);
	  

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