$(document).ready(function() {
// 手机导航
$('.menuBtn').append('');
$('.menuBtn').click(function(event) {
$(this).toggleClass('open');
var _winw = $(window).width();
var _winh = $(window).height();
if( $(this).hasClass('open') ){
$('body').addClass('open');
if( _winw<=981 ){
$('.nav').stop(true,true).slideDown();
}
}else{
$('body').removeClass('open');
if( _winw<=981 ){
$('.nav').stop(true,true).slideUp();
}
};
});
//导航
function myNav(){
var _winw = $(window).width();
if( _winw>981 ){
$('.nav').show();
$('body,.menuBtn').removeClass('open');
}else{
$('.nav').hide();
}
}
myNav();
$(window).resize(function(event) {
myNav();
$('.menuBtn').removeClass('open');
});
//视频播放
var video1 = document.getElementById('video1');
$('.btn-play').click(function(event) {
video1.play();
$(this).fadeOut();
$(this).siblings('.mask').fadeOut();
});
// 返回顶部
$('.to-top').click(function(){
$('body,html').animate({
scrollTop: 0
}, 500);
});
$(window).scroll(function() {
if($(window).scrollTop() >= 300){
$('.to-top').fadeIn(500);
}else{
$('.to-top').fadeOut(500);
}
});
});
//TAB切换
function SwapTab(name,title,content,Sub,cur){
$(name+' '+title).mouseover(function(){
$(this).addClass(cur).siblings().removeClass(cur);
$(content+" > "+Sub).eq($(name+' '+title).index(this)).show().siblings().hide();
});
}