//移动端菜单按钮
$('#wap-menu-btn').click(function() {
if ($('body').hasClass("menu-open")) {
$('body').removeClass("menu-open");
$('#menu').removeClass('open');
$('.nav-menu .nav-menu-item').removeAttr("style", "");
} else {
$('body').addClass("menu-open");
$('#menu').addClass('open');
$('.nav-menu .nav-menu-item').each(function(i, e) {
$(this).css({
'transition-delay': 1100 + 60 * i + 'ms',
'-webkit-transition-delay': 1100 + 60 * i + 'ms'
});
});
}
});
//nav-menu高度
$(window).bind("resize", function() {
nav_menu()
});
$(window).ready(function() {
nav_menu()
});
function nav_menu() {
var wH = $(window).height(),
wW = $(window).width(),
logoH = $('.menu-logo').outerHeight(),
shopH = $('.menu-shop').outerHeight(),
searchH = $('.menu-search').outerHeight();
$(".nav-menu").css({
"height": wH - logoH - shopH - searchH
});
if (wW > 992) {
$('body').removeClass("menu-open");
$('#wap-menu-btn').addClass("collapsed");
$('#wap-menu').removeClass("show");
}
};
//开启导航折叠一级链接跳转
$(document).ready(function() {
$(document).off('click.bs.dropdown.data-api');
});
//鼠标经过展开
$(document).ready(function() {
dropdownOpen();
});
function dropdownOpen() {
var $dropdownLi = $('.dropdown');
$dropdownLi.hover(function() {
$(this).addClass('show');
$(this).children(".dropdown-menu").stop(true, true).slideDown(800);
}, function() {
$(this).removeClass('show');
$(this).children(".dropdown-menu").stop(true, true).slideUp(0);
});
}
//页脚响应式折叠
$(window).bind("resize", function() {
addDataToggle();
});
$(document).ready(function() {
addDataToggle();
});
function addDataToggle() {
var wW = $(window).width();
if (wW < 992) {
$("#menu-nav li").find(".wap-link").addClass("collapsed");
$("#menu-nav li").eq(0).find(".wap-link").removeClass("collapsed");
$("#menu-nav li").find(".menu-subnav").removeClass("show");
$("#menu-nav li").eq(0).find(".menu-subnav").addClass("show");
$("#foot-nav .panel-button").attr("data-toggle", "collapse");
$("#foot-nav .panel-collapse").removeClass("show");
} else {
$("#menu-nav li").find(".wap-link").addClass("collapsed");
$("#menu-nav li").find(".menu-subnav").addClass("show");
$("#foot-nav .panel-button").attr("data-toggle", "");
$("#foot-nav .panel-collapse").addClass("show");
}
};
//返回顶部
$('.back-top').click(function(e) {
$("body,html").animate({
scrollTop: 0
}, 800);
});
//首页导航
/*$(window).ready(function() {
var scroll = $(window).scrollTop();
if (scroll > 0) {
$('body').removeClass('top');
} else {
$('body').addClass('top');
}
});
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 0) {
$('body').removeClass('top');
} else {
$('body').addClass('top');
};
});
var position = $(window).scrollTop();
$(window).scroll(function() {
var scroll = $(window).scrollTop();
//判断页面上滚下滚
if (scroll > position) {
$('body').addClass('down');
} else {
$('body').removeClass('down');
};
position = scroll;
});
*/
$(function() {
var owl = $('#banner');
owl.owlCarousel({
nav: true,
navText: ['', ''],
dots: true,
items: 1,
loop: true,
autoplay: true,
autoplayTimeout: 8000,
smartSpeed: 500,
fluidSpeed: 500,
autoplayHoverPause: false,
mouseDrag: false,
touchDrag: false,
animateOut: 'fadeOut',
animateIn: 'fadeIn',
onInitialized: dot1, //When the plugin has initialized.
});
function dot1() {
$("#banner .owl-dot").prepend('');
}
$('#banner .prev').click(function() {
owl.trigger('prev.owl.carousel');
})
$('#banner .next').click(function() {
owl.trigger('next.owl.carousel');
})
});
$(function() {
var owl = $('.notice');
owl.owlCarousel({
nav: false,
navText: ['', ''],
dots: false,
loop: true,
animateOut: 'slideOutDown ',
animateIn: 'slideInDown',
autoplay: true,
autoplayTimeout: 5000,
items: 1,
margin: 0,
slideTransition: 'linear',
smartSpeed: 300
});
});
$(function() {
var owl = $('.about-h');
owl.owlCarousel({
nav: true,
navText: ['', ''],
dots: false,
loop: false,
autoplay: true,
autoplayTimeout: 5000,
margin: 32,
smartSpeed: 300,
responsive: {
0: {
items: 1
},
565: {
items: 2
},
992: {
items: 3
},
1200: {
items: 4
}
}
});
});
/*视频剪切*/
//生成的容器做控件,需要在生成时设置控件事件
$(document).ready(function() {
$(".video-box").addClass('pause');
$(".video-box").click(function() {
if ($(this).hasClass('pause')) {
$(this).children('video').trigger('play');
$(this).removeClass('pause');
$(this).addClass('play');
loadheight();
} else {
$(this).children('video').trigger('pause');
$(this).removeClass('play');
$(this).addClass('pause');
loadheight();
}
});
});
//视频弹出
$(".video-link , .video-btn , .video-list a").on("click", function() {
var that = $(this);
var videoSrc = that.attr("video-src");
var videoPic = that.attr("video-poster");
$('#video').attr('src', videoSrc);
$('#video').attr('poster', videoPic);
loadheight();
});
$('#video-modal').on('show.bs.modal', function() {
$('#video-modal #video').trigger('play');
});
//关闭弹出视频
$('#video-modal').on('hide.bs.modal', function() {
$('#video-modal #video').attr('src', "");
$('#video-modal #video').attr('poster', "");
});
$('#video-modal').on('shown.bs.modal', function() {
var boxW = $("#video-modal .modal-dialog").width();
$("#video-modal #video").height(boxW * 0.5625);
});
$(window).resize(function() {
var boxW = $("#video-modal .modal-dialog").width();
$("#video-modal #video").height(boxW * 0.5625);
});
/*点击触发*/
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
$(".video-content video").each(function() {
var boxW = $(this).width();
$(this).height(boxW * 0.5625);
$(this).parent('.video-box').height(boxW * 0.5625);
});
})
/*表格*/
$(".video-tab").each(function() {
$(this).find("li").each(function(i) {
$(this).children().on("click", function() {
//alert(i)
$("video").trigger('pause');
$(".video-box").removeClass('play');
$(".video-box").addClass('pause');
$(this).parents().next().children(".video-cutting").trigger('pause');
$(this).parents().eq(i++).next().children(".video-cutting").trigger('play');
});
});
});
$('.index-p-nav a').mousemove(function(e) {
e.preventDefault()
$(this).tab('show')
});
//首页
/*详情留言选择*/
$(function() {
var Samples = $('#how_many').attr("samples");
var Placeholder = $('#how_many').attr("placeholder");
$("#Samples").on("click", function() {
$('#how_many').attr('disabled', '');
$('#how_many').attr('placeholder', Samples);
$('#how_many').val('');
})
$("#customized").on("click", function() {
$('#how_many').removeAttr('disabled');
$('#how_many').attr('placeholder', Placeholder);
})
})
//关闭弹出视频
$('#video-modal').on('hide.bs.modal', function() {
$('#video').attr('src', "");
$('#video').attr('poster', "");
});
$('#video-modal').on('shown.bs.modal', function() {
var boxW = $("#video-modal .modal-dialog").width();
$("#video").height(boxW * 0.5625);
});
$(function() {
var $window = $(window);
$window.on('resize', game_media);
function game_media() {
var wW = $(window).width();
wH = $(window).height();
if (wW < wH) {
$("body").addClass("wap-body");
} else {
$("body").removeClass("wap-body");
}
}
game_media();
});
/*产品详情滚动图*/
$(function() {
var owl = $('#product-img');
owl.owlCarousel({
items: 1,
nav: false,
navText: ['', ''],
dots: true,
dotsData: true,
loop: false,
margin: 16,
autoplay: false,
autoplayTimeout: 6000,
smartSpeed: 1000,
autoplayHoverPause: false,
});
});
//锚点滑动
$("a.navlink").click(function() {
var headHeight = $('#head').outerHeight();
var navHeight = $('.product-d-nav').outerHeight();
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top - headHeight - 16
}, {
duration: 600,
easing: "linear"
});
return false;
});
//锚点滑动
$("a.navlink2").click(function() {
var headHeight = $('#head').outerHeight();
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top - headHeight - 16
}, {
duration: 600,
easing: "linear"
});
return false;
});
//加入我们
jQuery.easing.jswing = jQuery.easing.swing;
jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function(e, f, a, h, g) { return jQuery.easing[jQuery.easing.def](e, f, a, h, g) }, easeInQuad: function(e, f, a, h, g) { return h * (f /= g) * f + a }, easeOutQuad: function(e, f, a, h, g) { return -h * (f /= g) * (f - 2) + a }, easeInOutQuad: function(e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f + a } return -h / 2 * ((--f) * (f - 2) - 1) + a }, easeInCubic: function(e, f, a, h, g) { return h * (f /= g) * f * f + a }, easeOutCubic: function(e, f, a, h, g) { return h * ((f = f / g - 1) * f * f + 1) + a }, easeInOutCubic: function(e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f + a } return h / 2 * ((f -= 2) * f * f + 2) + a }, easeInQuart: function(e, f, a, h, g) { return h * (f /= g) * f * f * f + a }, easeOutQuart: function(e, f, a, h, g) { return -h * ((f = f / g - 1) * f * f * f - 1) + a }, easeInOutQuart: function(e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f + a } return -h / 2 * ((f -= 2) * f * f * f - 2) + a }, easeInQuint: function(e, f, a, h, g) { return h * (f /= g) * f * f * f * f + a }, easeOutQuint: function(e, f, a, h, g) { return h * ((f = f / g - 1) * f * f * f * f + 1) + a }, easeInOutQuint: function(e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f * f + a } return h / 2 * ((f -= 2) * f * f * f * f + 2) + a }, easeInSine: function(e, f, a, h, g) { return -h * Math.cos(f / g * (Math.PI / 2)) + h + a }, easeOutSine: function(e, f, a, h, g) { return h * Math.sin(f / g * (Math.PI / 2)) + a }, easeInOutSine: function(e, f, a, h, g) { return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a }, easeInExpo: function(e, f, a, h, g) { return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a }, easeOutExpo: function(e, f, a, h, g) { return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a }, easeInOutExpo: function(e, f, a, h, g) { if (f == 0) { return a } if (f == g) { return a + h } if ((f /= g / 2) < 1) { return h / 2 * Math.pow(2, 10 * (f - 1)) + a } return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a }, easeInCirc: function(e, f, a, h, g) { return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a }, easeOutCirc: function(e, f, a, h, g) { return h * Math.sqrt(1 - (f = f / g - 1) * f) + a }, easeInOutCirc: function(e, f, a, h, g) { if ((f /= g / 2) < 1) { return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a } return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a }, easeInElastic: function(f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e }, easeOutElastic: function(f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e }, easeInOutElastic: function(f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k / 2) == 2) { return e + l } if (!j) { j = k * (0.3 * 1.5) } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } if (h < 1) { return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e } return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e }, easeInBack: function(e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * (f /= h) * f * ((g + 1) * f - g) + a }, easeOutBack: function(e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a }, easeInOutBack: function(e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } if ((f /= h / 2) < 1) { return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a } return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a }, easeInBounce: function(e, f, a, h, g) { return h - jQuery.easing.easeOutBounce(e, g - f, 0, h, g) + a }, easeOutBounce: function(e, f, a, h, g) { if ((f /= g) < (1 / 2.75)) { return h * (7.5625 * f * f) + a } else { if (f < (2 / 2.75)) { return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a } else { if (f < (2.5 / 2.75)) { return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a } else { return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a } } } }, easeInOutBounce: function(e, f, a, h, g) { if (f < g / 2) { return jQuery.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a } return jQuery.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a } });
$(function() {
$('#join .card').click(function() {
var headHeight = $("#head").height();
var cindex = $(this).index() - 1;
setTimeout(function() { $("html,body").animate({ scrollTop: $('#join .card').eq(cindex).offset().top - headHeight - 10 }, 800, 'easeInOutExpo'); }, 400);
});
});