function newwin()
{
var windowwidth=window.outerWidth||document.documentElement.clientWidth || document.body.clientWidth;
if(windowwidth<679)
{
function $(id)
{
return document.getElementById(id);
}
var timer=setInterval(function(){repeat()}, 1500);
var n = 1;
function startChange()
{
timer = window.setInterval(repeat, 1500);
}
function repeat()
{
change(n++ % 7, false);
}
function stopChange(x)
{
if (x < 7)
{
n = x + 1;
}
window.clearInterval(timer);
}
function change(x, isHandle)
{
if (isHandle) {
stopChange(x);
}
var buttons = $("buttons").getElementsByTagName("div");
var divv = $("divv").getElementsByTagName("section");
for ( var i = 0; i < buttons.length; i++)
{
buttons[i].className = "style1";
divv[i].className="closediv";
}
buttons[x].className = "style2";
divv[x].className="showdiv";
}
}
}
var timer1=null;
window.onresize=function()
{
timer1 && clearTimeout(timer1);
setTimeout(function()
{
newwin();
},200);
}
newwin();
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/58551.html
標籤:JavaScript
上一篇:js圖片隨著滑鼠飛問題
