var isMobile = false,
mobile = false,
win_width = 0,
win_height = 0,
navItem = 0,
atH =80,
$menuBtn = jQuery('.menu-handler'),
menuM=jQuery(".menubar"),
pageNavNum=0,
scrollNav=0,
_click="mouseenter";
var pageInit = {
init: function () {
win_width = $(window).width();
win_height = $(window).height();
if (win_width <= 1024) {
isMobile = true;
_click="click";
atH =54;
} else if (win_width > 1024) {
isMobile = false;
atH =80;
_click="mouseenter";
menu.close();
};
},
setImgMax: function (img, imgW, imgH, tW, tH) {
var tWidth = tW || win_width;
var tHeight = tH || win_height;
var coe = imgH / imgW;
var coe2 = tHeight / tWidth;
if (coe < coe2) {
var imgWidth = tHeight / coe;
img.css({ height: tHeight, width: imgWidth, left: -(imgWidth - tWidth) / 2, top: 0 });
} else {
var imgHeight = tWidth * coe;
img.css({ height: imgHeight, width: tWidth, left: 0, top: -(imgHeight - tHeight) / 2 });
};
},
setScroll: function (anchorCur) {
if(jQuery(anchorCur).length>=1){
jQuery("html,body").animate({ scrollTop: jQuery(anchorCur).offset().top-atH}, 0);
}
},
scollHeader: function() {
function c(){
var s = $(window).scrollTop();
if(!isMobile){
s > atH ? $(".top").addClass("ptop"): $(".top").removeClass("ptop");
}
}
$(window).scroll(c),
c();
},
splitWords:function (el) {
var _test = el.html().split('
');
el.html('');
for (var i = 0; i < _test.length; i++) {
el.append('
');
_test[i] = _test[i].split('');
var _span = el.find('span');
for (var j = 0; j < _test[i].length; j++) {
_span.eq(i).append('');
var _i = _span.eq(i).find('i');
if (_test[i][j] === ' ') { _test[i][j] = ' ' }
_i.eq(j).html(_test[i][j])
}
}
},
setWordsDelay:function (el, time, delay, reverse){
var _span = el.find('span');
_span.each(function(i) {
var _i = $(this).find('i');
_i.each(function(j) {
if (reverse) { j = _i.length - j - 1; }
$(this).css({
'animation-delay': delay + time*j + 'ms',
'-webkit-animation-delay': delay + time*j + 'ms'
})
})
})
},
setSplit:function(el){
var n=el;
for(var e=0,t=n.length;e=1){
jQuery('html').removeClass('md-show');
jQuery('.md-modal').remove();
};
$("body").append('');
$('.md-modal .vertical-inner').append(data);
setTimeout(function(){$("html").addClass("md-show");},50);
jQuery('.form-box-close').bind('click',function(e){
jQuery('html').removeClass('md-show');
setTimeout(function(){jQuery('.md-modal').remove();},400);
});
jQuery('.md-modal .vertical-inner').bind('click', function (e) {
if ($(e.target).hasClass('vertical-inner')) {
jQuery('html').removeClass('md-show');
setTimeout(function(){jQuery('.md-modal').remove();},400);
}
});
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
jQuery('html').removeClass('md-show');
setTimeout(function(){jQuery('.md-modal').remove();},400);
}
});
},
pbanner:function(){
if(jQuery('.pbanner').length>=1){
if (!isMobile) {
jQuery('.pbanner').css("height", jQuery(".pbanner .load-img").height());
} else {
jQuery('.pbanner').css("height", "auto");
}
jQuery('.pbanner').addClass("active");
};
}
},
nav={
init:function(){
jQuery(".nav li").hover(function () {
if (jQuery(this).find(".sub-nav").length > 0) {
$(this).children("a").addClass("hov");
$(this).find(".sub-nav").stop(false, false).animate({top:"100%","opacity":"show"},350);
};
}, function () {
$(this).children("a").removeClass("hov");
$(this).children(".sub-nav").stop(false, false).fadeOut(250,function(){$(this).css("top","80%");});
});
jQuery('.select-box').mouseenter(function(){
if($(this).hasClass('act')){
$(this).removeClass('act');
$(this).find('.mc').stop().slideUp(300);
}else{
$(this).addClass('act');
$(this).find('.mc').stop().slideDown(300);
}
}).mouseleave(function(){
$(this).removeClass('act');
$(this).find('.mc').stop().slideUp(300);
});
jQuery('.link-select-box').mouseenter(function(){
if($(this).hasClass('act')){
$(this).removeClass('act');
$(this).find('.mc').stop().slideUp(300);
}else{
$(this).addClass('act');
$(this).find('.mc').stop().slideDown(300);
}
}).mouseleave(function(){
$(this).removeClass('act');
$(this).find('.mc').stop().slideUp(300);
});
}
},
menu={
init:function(){
$menuBtn.click(function(){
if (navItem == 0) {
jQuery(this).addClass("active");
jQuery("html").addClass("menuOpen");
navItem = 1;
}else{
jQuery(this).removeClass("active");
jQuery("html").removeClass("menuOpen");
navItem = 0;
}
});
$(document).on("click", ".menubar>li>a", function (e) {
var mnavcur = $(this);
var mnavbox = $(this).parents("li");
if (mnavbox.find(".sub-menu").length > 0) {
if (mnavbox.hasClass("cur")) {
jQuery(".menubar>li>.sub-menu").stop(false, false).slideUp();
mnavbox.removeClass("cur");
} else {
jQuery(".menubar>li").removeClass("cur");
jQuery(".menubar>li>.sub-menu").stop(false, false).slideUp();
mnavbox.find(".sub-menu").stop(false, false).slideDown();
mnavbox.addClass("cur");
e.preventDefault();
}
}
});
$(document).on("click", ".menubar>li>a", function (e) {
var $this=jQuery(this);
var hash = $this.attr("href").split("#")[1];
if(hash && jQuery("#"+hash).length>=1){
e.preventDefault();
jQuery("html,body").animate({ scrollTop: jQuery("#"+hash).offset().top-atH},0);
menu.close();
}
});
$(".pusher-black,.menu-close").click(function () {
if (navItem == 1 ) {
menu.close();
};
});
},
close:function(){
$menuBtn.removeClass("active");
jQuery("html").removeClass("menuOpen");
navItem = 0;
}
},
pbanner={
init:function(){
if(jQuery(".load-img").length>=1){
_PreLoadImg([
jQuery(".load-img").attr("src")
],function(){
pageInit.pbanner();
});
jQuery(window).resize(function () {
pageInit.pbanner();
});
}
}
},
pageNav={
init:function(){
jQuery(".page-nav-btn a").click(function(e){
var $this=jQuery(this);
var hash = $this.attr("href").split("#")[1];
if(hash && jQuery("#"+hash).length>=1){
e.preventDefault();
jQuery("html,body").animate({ scrollTop: jQuery("#"+hash).offset().top-atH},800,'easeInOutExpo');
}
});
var $sec_nav = $('.page-nav-box');
if ($sec_nav.length) {
var $sec_n = $sec_nav.find('.page-nav-btn'),
$current_item = $sec_nav.find('.active').parent();
if (isMobile && $current_item.length>=1) {
$sec_n.stop().animate({
scrollLeft: $current_item.position().left
});
}
$(window).resize(function () {
if (isMobile && $current_item.length>=1) {
$sec_n.stop().animate({
scrollLeft: $current_item.offset().left + $sec_n.scrollLeft()
});
}
});
}
}
};
jQuery(window).resize(function () {
pageInit.init();
pbanner.init();
});
pageInit.init();
$(document).ready(function () {
nav.init();
menu.init();
pbanner.init();
pageNav.init();
jQuery(".backTop").bind("click", function() {
jQuery('html, body').stop(false,false).animate({scrollTop: 0}, 800,'easeInOutExpo');
});
});
jQuery(".vwrap .close,.vwrap .videobtg").click(function () {
jQuery(".vwrap").hide();
$('#videobox').html("");
});
$(window).on('load',function(){
$('.page-nav').onePageNav();
var hash = location.href.split("#")[1];
if (hash) {
pageInit.setScroll("#" + hash);
}
})