$(function(){
/**
* 绐楀彛鐩戞帶
*/
function watch_window(){
var width = $(this).width();
if(width > 992){
$('html').attr('class','site-md')
}else if(width < 768){
$('html').attr('class','site-xs')
}else if (width < 992) {
$('html').attr('class','site-sm')
}
}
watch_window();
$(window).on('resize',watch_window);
/**
* 瑙嗛绐楀彛
*/
layui.use('layer', function(){
$('.video .play').on('click',function(){
layer.open({
skin: 'layui-layer-lan',
area: ['80%', '80%'],
title: '瑙嗛绐楀彛',
content: '
\
\
'
});
})
});
// layui.use('layer', function(){
// $('.video .play').on('click',function(){
// layer.open({
// skin: 'layui-layer-lan',
// area: ['80%', '80%'],
// title: '瑙嗛绐楀彛',
// content: ''
// });
// })
//
// });
/**
* dropdown 涓嬫媺鑿滃崟
*/
/*(function(button,list){
$(button).on('click',function(){
var isEnabled = $(this).data('enabled');
if(!isEnabled){
$(this).next(list).slideDown(400);
$(this).data('enabled',true);
}else{
$(this).next(list).slideUp(400);
$(this).data('enabled',false);
}
})
$(button).on('selectstart',function(){
return false;
})
})('.dropdown-button','.dropdown-list');*/
$("#header .site-toper .right > ul > li").hoverDelay({
hoverDuring: 100,
hoverEvent: function(){
$('.dropdown-list',this).slideDown(400);
},
outEvent: function(){
$('.dropdown-list',this).slideUp(400);
}
})
/**
* 寰俊QR
*/
$("#header .tool .QR").hoverDelay({
hoverDuring: 100,
hoverEvent: function(){
$('.hidden',this).fadeIn('fast');
},
outEvent: function(){
$('.hidden',this).fadeOut('fast');
}
})
/**
* 鎼滅储
*/
$('#header .tool .search,#header .sm-tool .search').on('click',function(){
if($(this).data('enabled')){
}else{
$('#search-bg,#search-form').css({'display':'block'});
setTimeout(function(){
$('#search-bg,#search-form').css({'opacity':1})
},100)
$(this).data('enabled',true);
}
})
$('#search-form .close').on('click',function(){
$('#search-bg,#search-form').css({'opacity':0})
setTimeout(function(){
$('#search-bg,#search-form').css({'display':'none'});
},500)
$('#header .tool .search,#header .sm-tool .search').data('enabled',false);
})
/**
* 涓诲鑸笅鎷
*/
$(".site-md #header .nav > li").hoverDelay({
hoverEvent: function(){
$('.children',this).slideDown('normal','easeOutBack');
},
outEvent: function(){
$('.children',this).slideUp('fast','easeOutQuad');
}
})
$(document).on('click','.site-sm #header .menu,.site-xs #header .menu',function(){
if($(this).data('enabled')){
$('#header .nav').slideUp('fast','easeOutQuad');
$(this).data('enabled',false);
}else{
$('#header .nav').slideDown('fast','easeOutQuad');
$(this).data('enabled',true);
}
})
$(document).on('click','.site-sm #header .nav > li > a,.site-xs #header .nav > li > a',function(){
if($(this).data('enabled')){
$(this).next('.children').slideUp('fast','easeOutQuad');
$(this).data('enabled',false);
}else{
$(this).next('.children').slideDown('fast','easeOutQuad');
$(this).data('enabled',true);
}
if($(this).next('.children')[0]){
return false;
}
})
$(document).on('click','.site-xs #footer .list .item dt',function(){
if($(this).data('enabled')){
$(this).nextAll('dd').show();
$(this).data('enabled',false);
}else{
$(this).nextAll('dd').hide();
$(this).data('enabled',true);
}
})
/**
* 鍥哄畾鏁堟灉
*/
$(window).scroll(function(){
var top = $('body').scrollTop();
if(top > 0){
$('#header,#fixed-banner').addClass('isFixed');
}else{
$('#header,#fixed-banner').removeClass('isFixed');
}
});
/**
* 鎷涜仒
*/
$('.ui-list-job li').on('click',function(){
if($(this).hasClass('active')){
$(this).removeClass('active')
$('.body',this).slideUp()
}else{
$(this).addClass('active');
$('.body',this).slideDown();
}
$(this).one('selectstart',function(){
return false;
})
})
/**
* goTop
*/
$('#footer .goTop').on('click',function(){
$('body,html').animate({scrollTop:0},600);
})
})