$(function(){ $('.flexslider').flexslider({ animation: "slide", start: function(slider){ $('body').removeclass('loading'); } }); }); function gundong (id) { var obtnleft = document.getelementbyid("goleft_"+id); var obtnright = document.getelementbyid("goright_"+id); var odiv = document.getelementbyid("indexmaindiv_"+id); var odiv1 = document.getelementbyid("maindiv1_"+id); var oul = odiv.getelementsbytagname("ul")[0]; var ali = oul.getelementsbytagname("li"); var now = -1* (ali[0].offsetwidth); oul.style.width = ali.length * (ali[0].offsetwidth ) + 'px'; obtnright.onclick = function () { var n = math.floor((ali.length * (ali[0].offsetwidth ) + oul.offsetleft) / ali[0].offsetwidth); if (n <= 3) { move(oul, 'left', 0); } else { move(oul, 'left', oul.offsetleft + now); } } obtnleft.onclick = function () { var now1 = -math.floor((ali.length / 3)) * 1 * (ali[0].offsetwidth); var n = math.floor((ali.length * (ali[0].offsetwidth ) + oul.offsetleft) / ali[0].offsetwidth); if (n <= 3) { move(oul, 'left', 0); } else { if (oul.offsetleft >= 0) { move(oul, 'left', now1); } else { move(oul, 'left', oul.offsetleft - now); } } } var timer = setinterval(obtnright.onclick, 5000); odiv.onmouseover = function () { clearinterval(timer); } odiv.onmouseout = function () { timer = setinterval(obtnright.onclick, 5000); } }; function getstyle(obj, name) { if (obj.currentstyle) { return obj.currentstyle[name]; } else { return getcomputedstyle(obj, false)[name]; } } function move(obj, attr, itarget) { clearinterval(obj.timer) obj.timer = setinterval(function () { var cur = 0; if (attr == 'opacity') { cur = math.round(parsefloat(getstyle(obj, attr)) * 100); } else { cur = parseint(getstyle(obj, attr)); } var speed = (itarget - cur) / 6; speed = speed > 0 ? math.ceil(speed) : math.floor(speed); if (itarget == cur) { clearinterval(obj.timer); } else if (attr == 'opacity') { obj.style.filter = 'alpha(opacity:' + (cur + speed) + ')'; obj.style.opacity = (cur + speed) / 100; } else { obj.style[attr] = cur + speed + 'px'; } }, 30); }