function imgre_dom(time, int_time) { $('head').append(``) var nowli = 0 var oldli = 0 var aa $('.zgj_news_dot').find('.dot').eq(0).addclass("selected") $('.zgjimg_tabs').find('li').eq(0).css("left", 0) $('.zgj_news_dot').find('.dot').click(function () { nowli = $(this).index() $(this).addclass().addclass("selected").siblings().removeclass('selected') cleartimeout(aa) move(nowli) }) move() function move() { $('.zgj_news_dot').find('.dot').eq(nowli).addclass().addclass("selected").siblings().removeclass('selected') if (nowli != oldli) { $('.zgjimg_tabs').find('li').eq(oldli).stop(true, true).animate({ "left": '-100%' }, time, function () { $(this).css("left", '100%') }) $('.zgjimg_tabs').find('li').eq(nowli).stop(true, true).animate({ "left": 0 }, time) } oldli = nowli aa = settimeout(function () { nowli++ if (nowli >= $('.zgjimg_tabs').find('li').length) { nowli = 0 } move(nowli) }, int_time) } }