$(function() { (function() { var sup = $("#idxbanner"), pics = sup.find(".pics li"), curr_p = pics.eq(0), next_p = null, idxs = sup.find(".idxs li"), curr_i = idxs.eq(0), next_i = null, left = sup.find(".btns .left"), right = sup.find(".btns .right"), idx = 0, idx_m = pics.length - 1, tt = 0, delay = 5000; $(window).on("load", function() { idxs.hover(idxhoveron, function() {}); idxs.hover(function() { cleartimeout(tt) }, function() {}); sup.hover(banhoveron, banhoverout); sup.hover(function() { cleartimeout(tt) }, function() { if (pics.length > 1) { auto() } }); left.on("click", function() { btnclick(idxdec()) }); right.on("click", function() { btnclick(idxinc()) }); if (pics.length > 1) { auto() } }); function auto() { tt = settimeout(function() { fade(idxinc()) }, delay) } function fade(i) { cleartimeout(tt); curr_p.stop(false, true).fadeout(500); curr_p = next_p = pics.eq(i).stop(false, true).fadein(); curr_i.removeclass("on"); curr_i = next_i = idxs.eq(i).addclass("on"); auto() } function idxinc() { return idx === idx_m ? idx = 0 : ++idx } function idxdec() { return idx === 0 ? idx = idx_m: --idx } function banhoveron() { left.stop().animate({ "left": 0 }, 150); right.stop().animate({ "right": 0 }, 150) } function banhoverout() { left.stop().animate({ "left": -43 }); right.stop().animate({ "right": -43 }) } function btnclick(i) { fade(i) } function idxhoveron(elem) { cleartimeout(tt); idx = $(this).index(); fade(idx) } })(); $(".pro-box a").hover(function() { $(this).css({ "margin-top": "0px" }); $(this).addclass('showtext') }, function() { $(this).css({ "margin-top": "59px" }); $(this).removeclass('showtext') }); /* var navparent = $(".header"), navline = navparent.find(".navline"), navcurrent = navparent.find(".nav .current"); var initleft = navline.position().left, initwidth = navline.width(); navparent.find(".nav li").hover(function() { var navlinewidth = $(this).find("a").width(); var offsetli = $(this).position().left + 18; navline.css({ 'width': navlinewidth }).stop().animate({ 'left': offsetli }, 300) }); */ $(".headrange").hover(function() {}, function() { navline.css({ 'width': initwidth }).stop().animate({ 'left': initleft }, 300) }) }); $(function(){ var _$navtoggle = $('#navbar_toggle'); var _$nav = $('#navbar'); var _$navmobile = $('#navbarmobile'); var _initmenu = false; var _initmenumobile = false; init(); function init() { $(window).resize(function(e){ resizewin(); }); resizewin(); } function resizewin() { if($(window).width() <= 767){ initmenumobile(); }else{ initmenu(); } } function initmenu() { _$nav.show(); _$navmobile.hide(); if(!_initmenu){ _initmenu = true; }else{ return; } var $curnav; var $on = false; try{ if(__curpage != undefined){ $curnav = $('.nav > li.'+__curpage, _$nav); $curnav.addclass('active'); } }catch (e){} $(".nav > li", _$nav).hover( function () { $(this).addclass("hover"); $('.snor', this).addclass("hover"); if($curnav) $curnav.removeclass('active'); }, function () { //if($on) return false; $(this).removeclass("hover"); $('.snor', this).removeclass("hover"); if($curnav) $curnav.addclass('active'); } ); } function initmenumobile() { _$nav.hide(); if(!_initmenumobile){ _initmenumobile = true; }else{ return; } _$navtoggle.on('click', function(e){ e.preventdefault(); _$navmobile.slidetoggle(); }); _$navmobile.on('click', '>ul>li>a', function(e){ var $item = $(this).parent(); var $snor = $(this).next(); if($snor.length){ $item.toggleclass('show-snor'); $snor.slidetoggle(); } }); var $footnav = $('#navbarmobilefoot'); try{ if(__curpage != undefined) { var $curnav = $('.nav > li.'+__curpage, $footnav); var $curnavsnor = $('>ul', $curnav); if($curnavsnor.length) { $curnav.toggleclass('show-snor'); $curnavsnor.slidetoggle(); } } }catch (e){} $footnav.on('click', '>ul>li>a', function(e){ var $item = $(this).parent(); var $snor = $(this).next(); if($snor.length){ $item.toggleclass('show-snor'); $snor.slidetoggle(); } }); } });