(function($) { "use strict"; //preloader // function handlepreloader() { // if($('.preloader').length){ // $('.preloader').delay(100).fadeout(500); // } // } //update header style + scroll to top function headerstyle() { if($('.main-header').length){ var windowpos = $(window).scrolltop(); if (windowpos >= 80) { $('.main-header').addclass('fixed-header'); $('.scroll-to-target').css({ "display":"block" }) } else { $('.main-header').removeclass('fixed-header'); $('.scroll-to-target').css({ "display":"none" }) } } } headerstyle(); //hidden bar menu config function hiddenbarmenuconfig() { var menuwrap = $('.hidden-bar .side-menu'); // appending expander button menuwrap.find('.dropdown').children('a').append(function () { return ''; }); // hidding submenu menuwrap.find('.dropdown').children('ul').hide(); // toggling child ul menuwrap.find('.btn.expander').each(function () { $(this).on('click', function () { $(this).parent() // return parent of .btn.expander (a) .parent() // return parent of a (li) .children('ul').slidetoggle(); // adding class to expander container $(this).parent().toggleclass('current'); // toggling arrow of expander $(this).find('i').toggleclass('fa-minus fa-bars'); return false; }); }); } //hidden bar toggler function hiddenbartoggler() { if ($('.hidden-bar-closer').length) { $('.hidden-bar-closer').on('click', function () { $('.hidden-bar').removeclass('visible-sidebar'); }); } if ($('.hidden-bar-opener').length) { $('.hidden-bar-opener').on('click', function () { $('.hidden-bar').addclass('visible-sidebar'); }); } } //custom scroll bar for hidden sidebar function customscrollbarhiddensidebar() { if ($('.hidden-bar-wrapper').length) { $('.hidden-bar-wrapper').mcustomscrollbar(); } } // scroll to a specific div if($('.scroll-to-target').length){ $(".scroll-to-target").on('click', function() { var headerheight = $('.header-lower').height(); var target = $(this).attr('data-target'); // animate $('html, body').animate({ scrolltop: 0 }, 1000); }); } // elements animation // if($('.wow').length){ // var wow = new wow( // { // boxclass: 'wow', // animateclass: 'animated', // offset: 0, // distance to the element when triggering the animation (default is 0) // mobile: false, // trigger animations on mobile devices (default is true) // live: true // act on asynchronously loaded content (default is true) // } // ); // wow.init(); // } /* ========================================================================== when document is ready, do ========================================================================== */ $(document).on('ready', function() { customscrollbarhiddensidebar(); hiddenbartoggler(); hiddenbarmenuconfig(); // enablemasonry(); }); /* ========================================================================== when document is scrollig, do ========================================================================== */ $(window).on('scroll', function() { headerstyle(); // factcounter(); }); /* ========================================================================== when document is loaded, do ========================================================================== */ // $(window).on('load', function() { // handlepreloader(); // enablemasonry(); // }); // ******************************************comm****************************************** // 显示子导航 $(".navigation li > a").on("mouseover",function(){ // $(".lower-section").animate({ // height: '390px' // }) if ($(".sub-nav:visible").size()>0) { $(".sub-nav").hide(); $(this).next(".sub-nav").show(); }else{ $(this).next(".sub-nav").slidedown(); } }) $(".nav-up").on("click",function () { $(".sub-nav").delay(100).slideup() }) $(".sub-nav").on("mouseleave",function(){ $(this).delay(100).slideup(); }) // ********************************** tab 切换 ***********************************// // 1、子导航切换 $(".tab-nav > a").on("mouseover",function(){ $(this).addclass("cur").siblings("a").removeclass("cur"); $(this).parent().next('.tab-con').children('.tab-item:eq('+$(this).index()+')').show().siblings().hide(); }) // 2、首页-资讯中心 $(".zx-nav > a").on("click",function(){ $(this).addclass("cur").siblings("a").removeclass("cur") $('.zx-items .zx-item:eq('+$(this).index()+')').show().siblings('.zx-item').hide() }) // 3、媒体中心 // $(".mtzx-nav a").on("click",function(){ // $(this).addclass("cur").siblings("a").removeclass("cur") // $('.tab-wrap .tab-hyxw:eq('+$(this).index()+')').show().siblings('.tab-hyxw').hide() // }) //关于我们 $(".lj-tabnav > a").on("click",function(){ $(this).addclass("on").siblings("a").removeclass("on"); $('.lj-tabcon > p:eq('+$(this).index()+')').show(1000).siblings("p").hide(1000) }) // *********************************** flexslider *********************************** // 首页-- banner // $(".flexslider").flexslider({ // slideshowspeed: 4000, //展示时间间隔ms // animationspeed: 400, //滚动时间ms // touch: true, //是否支持触屏滑动 // slideshow:false // }); // ********************************** owlcarousel ********************************** // // $("#owl-yyly").owlcarousel({ // items: 3, // pagination: false, // navigation: true // }) // 屏蔽右键 // function stop(){ return false;} // document.oncontextmenu=stop; })(window.jquery);