// 底部大图轮播 (function () { var oContain = document.getElementById("bannerContainer"); var oMt = document.getElementById("stm"); var oLt = document.getElementById("pic_left"); var oRt = document.getElementById("pic_right"); var aP = oMt.children; var iLen = aP.length; var result = true; var Lresult = true; var iWidth = aP[0].clientWidth; inum = 1; $("div[index='1']").show(); oMt.style.width = iLen * iWidth + "px"; oRt.onclick = function () { autostart(); }; oLt.onclick = function () { if (Lresult) { inum--; if (inum < 0) inum = iLen - 1; Lresult = false; oMt.insertBefore(oMt.children[iLen - 1].cloneNode(true), oMt.children[0]); oMt.style.left = -iWidth + "px"; $(oMt).animate({left: 0}, 800, function () { oMt.removeChild(oMt.children[iLen]); // $("div[index]").hide(); // $("div[index='" + inum + "']").show(); $('.indexContainer span').removeClass('checked'); $('.indexContainer span').eq(inum).addClass('checked'); Lresult = true; }); } }; function autostart() { if (result) { inum++; if (inum > iLen - 1) inum = 0; result = false; oMt.appendChild(oMt.children[0].cloneNode(true)); $(oMt).animate({left: -iWidth}, 800, function () { oMt.removeChild(oMt.children[0]); oMt.style.left = "0px"; // $("div[index]").hide(); // $("div[index='" + inum + "']").show(); $('.indexContainer span').removeClass('checked'); $('.indexContainer span').eq(inum).addClass('checked'); result = true; }); } } var timer = setInterval(autostart, 5000); oContain.onmouseover = function () { clearInterval(timer); }; oContain.onmouseout = function () { timer = setInterval(autostart, 5000); }; $('.indexContainer span').click(function () { if (result && Lresult) { result = false; Lresult = false; $('.indexContainer span').removeClass('checked'); $(this).addClass('checked'); if ($(this).index() > inum) { console.log($(this).index() - inum); var num = $(this).index() - inum; inum = $(this).index(); result = false; for (var i = 0; i < num; i++) { oMt.appendChild(oMt.children[i].cloneNode(true)); } $(oMt).animate({left: -iWidth * num + 'px'}, 800, function () { for (var i = 0; i < num; i++) { oMt.removeChild(oMt.children[0]); } oMt.style.left = "0px"; result = true; Lresult = true; }); } else if ($(this).index() < inum) { var num = inum - $(this).index(); inum = $(this).index(); Lresult = false; for (var i = 0; i < num; i++) { oMt.insertBefore(oMt.children[iLen - 1].cloneNode(true), oMt.children[i]); } $(oMt).css('left', -iWidth * num + "px").animate({left: 0}, 800, function () { for (var i = 0; i < num; i++) { oMt.removeChild(oMt.children[iLen]); } result = true; Lresult = true; }); } } }) })(); (function () { var canLeft = true, canRight = true, aLength = $('.newGameListContainer a').length - 1; $('.newGameRight').on('click', function () { if (canLeft) { canLeft = false; $('.newGameListContainer').animate({left: '-1200px'}, 1000, function () { $('.newGameListContainer').append($('.newGameListContainer a').eq(0)); $('.newGameListContainer').append($('.newGameListContainer a').eq(0)); $('.newGameListContainer').append($('.newGameListContainer a').eq(0)); $('.newGameListContainer').append($('.newGameListContainer a').eq(0)); $('.newGameListContainer').css('left', 0); canLeft = true; }) } }); $('.newGameLeft').on('click', function () { if (canRight) { canRight = false; $('.newGameListContainer').prepend($('.newGameListContainer a').eq(aLength)); $('.newGameListContainer').prepend($('.newGameListContainer a').eq(aLength)); $('.newGameListContainer').prepend($('.newGameListContainer a').eq(aLength)); $('.newGameListContainer').prepend($('.newGameListContainer a').eq(aLength)); $('.newGameListContainer').css('left', '-1200px').animate({left: 0}, 1000, function () { canRight = true; }); } }) }()); // 排序 $('.sortContent').on('click', function () { if ($('.otherSort').css('display') == 'none') { $('.otherSort').show(); } else { $('.otherSort').hide(); } });