﻿var speed=20; 
//var marqueeWidth = 110;
var tab=$("market_scorll");
var tab1=$("demo1");
var tab2=$("demo2");
tab2.innerHTML=tab1.innerHTML;
//var currentLeft = marqueeWidth;
//var stopTime = 0;
function Marquee(){
    //currentLeft+=1;
//    if(currentLeft==marqueeWidth+1)
//    {
//        stopTime+=1;
//        currentLeft-=1;
//        //此处控制换图片的速度
//        if(stopTime==300)
//        {
//            currentLeft = 0;
//            stopTime = 0;
//        }
//    }else{
        if(tab2.offsetWidth-tab.scrollLeft<=0)
            tab.scrollLeft-=tab1.offsetWidth
        else{
            tab.scrollLeft++;
        }
   // }
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};