');
$(window)
.on('scroll', function () {
var winTop_2 = $(window)
.scrollTop();
holder.css('height', headH);
if (winTop_2 > headH + 30 && winWidth > 980) {
holder.show()
.appendTo($nav);
$nav.addClass('fixed-nav');
$nav.parents('body')
.addClass('fixed-body');
setTimeout(function () { $nav.addClass('fixed-nav-active') });
} else {
holder.hide();
$nav.removeClass('fixed-nav fixed-nav-active');
$nav.parents('body')
.removeClass('fixed-body');
}
if (winTop_2 > winTop_1 && winWidth > 980) {
$nav.removeClass('fixed-nav-appear');
} else if (winTop_2 < winTop_1) {
$nav.addClass('fixed-nav-appear');
}
winTop_1 = $(window)
.scrollTop();
})
$('.faq-item')
.each(function (index) {
var _this = $(this)
var title = _this.find('.faq-title')
var cont = _this.find('.faq-cont')
if (index == 0) {
title.addClass('show-title')
}
title.on('click', function () {
if (cont.is(':hidden') && !$(this)
.hasClass('show-title')) {
cont.slideDown('fast')
$(this)
.addClass('show-title')
_this.siblings()
.find('.faq-title')
.removeClass('show-title')
_this.siblings()
.find('.faq-cont')
.slideUp('fast')
} else {
cont.slideUp('fast')
$(this)
.removeClass('show-title')
}
})
})
function mSizeChange() {
if (window.innerWidth)
winWidth = window.innerWidth;
else if ((document.body) && (document.body.clientWidth))
winWidth = document.body.clientWidth;
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
if (winWidth <= 950) {
if ($('.mobile-head-items')
.length < 1) {
var mobileService = '
'
$('body')
.append(mobileService)
if ($('body .aside')
.length > 0) {
$('.mobile-head-items')
.append('
')
}
$('.mobile-head-item')
.each(function () {
$(this)
.find('.title')
.click(function () {
if ($(this)
.parents('.mobile-head-item')
.find('.main-content-wrap')
.length > 0) {
var pItem = $(this)
.parents('.mobile-head-item')
if (!pItem.find('.main-content-wrap')
.hasClass('show-content-wrap')) {
pItem.find('.main-content-wrap')
.addClass('show-content-wrap')
pItem.find('.side-content-wrap')
.stop()
.animate({ 'left': '0' }, 300)
pItem.find('.middle-content-wrap')
.addClass('middle-show-content-wrap')
pItem.find('.side-content-wrap')
.append("
")
pItem.siblings('.mobile-head-item')
.find('.main-content-wrap')
.removeClass('show-content-wrap')
pItem.siblings('.mobile-head-item')
.find('.side-content-wrap')
.stop()
.animate({ 'left': '-70%' }, 300)
pItem.siblings('.mobile-head-item')
.find('.middle-content-wrap')
.removeClass('middle-show-content-wrap')
pItem.siblings('.mobile-head-item')
.find('.side-content-wrap .mobile-ico-close')
.remove()
if ($('.mobile-head-items')
.find('.mobile-body-mask')
.length < 1) {
$('.mobile-head-items')
.append('
')
}
} else {
pItem.find('.main-content-wrap')
.removeClass('show-content-wrap')
pItem.find('.side-content-wrap')
.stop()
.animate({ 'left': '-70%' }, 300)
pItem.find('.middle-content-wrap')
.removeClass('middle-show-content-wrap')
pItem.find('.side-content-wrap .mobile-ico-close')
.remove()
}
$('.mobile-body-mask')
.click(function () {
$('.mobile-body-mask')
.remove()
$('.mobile-head-item .main-content-wrap')
.removeClass('show-content-wrap')
$('.mobile-head-item .side-content-wrap')
.animate({ 'left': '-70%' }, 300)
$('.mobile-head-item .middle-content-wrap')
.removeClass('middle-show-content-wrap')
$('.mobile-head-item .side-content-wrap .mobile-ico-close')
.remove()
})
$('.mobile-ico-close')
.click(function () {
$('.mobile-body-mask')
.remove()
$('.mobile-head-item .main-content-wrap')
.removeClass('show-content-wrap')
$('.mobile-head-item .side-content-wrap')
.stop()
.animate({ 'left': '-70%' }, 300)
$('.mobile-head-item .middle-content-wrap')
.removeClass('middle-show-content-wrap')
$('.mobile-head-item .side-content-wrap .mobile-ico-close')
.remove()
})
}
})
})
$('.change-currency ')
.clone()
.appendTo('.mobile-head-item.mobile-head-currency .main-content-wrap .content-wrap')
$('.change-language .change-language-cont')
.clone()
.appendTo('.mobile-head-item.mobile-head-language .main-content-wrap .content-wrap')
$('.nav_wrap .head_nav')
.clone()
.appendTo('.mobile-head-item.mobile-head-nav .main-content-wrap .content-wrap')
$('.head-search:last')
.clone()
.appendTo('.mobile-head-item.mobile-head-search .main-content-wrap .content-wrap')
$('.head_sns')
.clone()
.appendTo('.mobile-head-item.mobile-head-social .main-content-wrap .content-wrap')
$('.aside .aside-wrap')
.clone()
.appendTo('.mobile-head-item.mobile-head-aside .main-content-wrap .content-wrap')
}
}
//mobile end
else {
$(document)
.ready(function () {
$('.mobile-body-mask,.mobile-head-items,.mobile-head-items,.mobile-nav-items,.mobile-cart-items,.mobile-tab-items')
.remove()
});
}
}
$(function () { mSizeChange(); })
$(window)
.resize(function () { mSizeChange() });
/*side*/
$(function () {
$('.side-widget .side-cate li')
.each(function () {
if ($(this)
.find('ul')
.length > 0) {
$(this)
.append("
")
$(this)
.children('.icon-cate')
.click(function (e) {
if ($(this)
.parent('li')
.children('ul')
.is(':hidden')) {
$(this)
.parent('li')
.children('ul')
.slideDown(100);
$(this)
.removeClass('icon-cate-down')
.addClass('icon-cate-up');
} else {
$(this)
.parent('li')
.children('ul')
.slideUp(100);
$(this)
.removeClass('icon-cate-up')
.addClass('icon-cate-down');
}
e.stopPropagation();
})
}
})
if ($('.side-widget .side-cate .nav-current')
.parents('ul')
.length > 0 && $('.side-widget .side-cate .nav-current')
.find('ul')
.length > 0) {
$('.side-widget .side-cate .nav-current')
.parents('ul')
.show()
$('.side-widget .side-cate .nav-current')
.parents('li')
.addClass("show_li")
$('.side-widget .side-cate .nav-current')
.parents('li.show_li')
.children('.icon-cate')
.removeClass('icon-cate-down')
.addClass('icon-cate-up')
$('.side-widget .side-cate .nav-current')
.children('ul')
.show()
$('.side-widget .side-cate .nav-current ')
.children('.icon-cate')
.removeClass('icon-cate-down')
.addClass('icon-cate-up');
} else if ($('.side-widget .side-cate .nav-current')
.parents('ul')
.length > 0 && $('.side-widget .side-cate .nav-current')
.find('ul')
.length < 1) {
$('.side-widget .side-cate .nav-current')
.parents('ul')
.show()
$('.side-widget .side-cate .nav-current')
.parents('li')
.addClass("show_li")
$('.side-widget .side-cate .nav-current')
.parents('li.show_li')
.children('.icon-cate')
.removeClass('icon-cate-down')
.addClass('icon-cate-up')
} else if ($('.side-widget .side-cate .nav-current')
.parents('ul')
.length < 1 && $('.side-widget .side-cate .nav-current')
.find('ul')
.length > 0) {
$('.side-widget .side-cate .nav-current')
.children('ul')
.show()
$('.side-widget .side-cate .nav-current')
.children('.icon-cate')
.removeClass('icon-cate-down')
.addClass('icon-cate-up');
}
})
/*tabContainer*/
function tabContainer(container, title, panel) { $(container)
.each(function () { $(this)
.find(title)
.each(function () { if ($(this)
.hasClass('current')) { j = $(this)
.index();
$(this)
.parents(container)
.find(panel)
.eq(j)
.removeClass('disabled') } $(this)
.click(function () { i = $(this)
.index();
$(this)
.addClass('current')
.siblings()
.removeClass('current');
$(this)
.parents(container)
.find(panel)
.eq(i)
.show();
$(this)
.parents(container)
.find(panel)
.not($(this)
.parents(container)
.find(panel)
.eq(i))
.hide(); }) }) }) }
/*search*/
document.documentElement.className = 'js';;
(function (window) {
if (document.querySelector('.web-search')) {
'use strict';
var mainContainer = document.querySelector('.container')
, searchContainer = document.querySelector('.web-search')
, openCtrl = document.getElementById('btn-search')
, closeCtrl = document.getElementById('btn-search-close')
, inputSearch = searchContainer.querySelector('.search-ipt');
function init() { initEvents() }
function initEvents() {
openCtrl.addEventListener('click', function () { if (!searchContainer.classList.contains("search--open")) { openSearch(); } else { closeSearch(); } });
closeCtrl.addEventListener('click', closeSearch);
document.addEventListener('keyup', function (ev) { if (ev.keyCode == 27) { closeSearch() } })
}
function openSearch() { mainContainer.classList.add('main-wrap--move');
searchContainer.classList.add('search--open');
setTimeout(function () { inputSearch.focus() }, 600) }
function closeSearch() { mainContainer.classList.remove('main-wrap--move');
searchContainer.classList.remove('search--open');
inputSearch.blur();
inputSearch.value = '' } init()
}
})(window);
$(function () { $("#scrollsidebar")
.fix({ float: 'right', durationTime: 400 }); });
$('.business_right .events li')
.on('click', function () {
$(this)
.addClass('current')
.siblings("li")
.removeClass('current')
var i = $(this)
.index()
$(this)
.parents('.index_business')
.find('.business_middle .tab_content')
.eq(i)
.addClass('current')
.siblings(".tab_content")
.removeClass('current')
})
$('table')
.each(function () {
if (!$(this)
.parent()
.hasClass('table_wrap')) {
$(this)
.wrap("
/div>")
}
})
/* -------------- header --------------*/
// dropmenu direction
$(function () {
menuDirection('.head_nav>li');
$(window)
.on('resize', function () {
menuDirection('.head_nav>li');
})
})
function menuDirection(ele) {
var winW = $(window)
.innerWidth();
$(ele)
.each(function () {
if ($(this)
.find('ul')
.length) {
var linkEleW = $(this)
.children('a')
.width();
var offRight = winW - $(this)
.offset()
.left;
var childLen = $(this)
.find('ul')
.length;
var childrenWidth = childLen * 250 + 10;
if (offRight < childrenWidth) {
$(this)
.addClass('menu_left');
} else {
$(this)
.removeClass('menu_left');
}
}
})
}
/* -------------- index --------------*/
var pdSwiper = new Swiper('.index_product .product_slider', {
slidesPerView: 4
, speed: 400
, spaceBetween: 20
, pagination: {
el: '.index_product .swiper-pagination'
, clickable: true
, }
, navigation: {
nextEl: '.index_product .swiper-button-next'
, prevEl: '.index_product .swiper-button-prev'
, }
, breakpoints: {
1200: {
slidesPerView: 3
}
, 950: {
slidesPerView: 3
, spaceBetween: 16
}
, 767: {
slidesPerView: 2
, spaceBetween: 10
}
, 640: {
slidesPerView: 2
, spaceBetween: 10
}
, 480: {
slidesPerView: 2
, spaceBetween: 10
}
}
});
/* -------------- subpage --------------*/
var bnSwiper = new Swiper('.main_banner_slider', {
effect: 'fade'
, speed: 1000
, loop: true
, spaceBetween: 0
, autoplay: {
delay: 3500
, disableOnInteraction: false
, }
, pagination: {
el: '.main_banner_slider .swiper-pagination'
, clickable: true
, }
});
// search
$(function () {
$(document)
.on('click', function () {
$('.container')
.removeClass('main-wrap--move');
$('.web-search')
.removeClass('search--open');
})
$('.btn--search,.web-search')
.on('click', function (e) {
e.stopPropagation();
})
})
// button
$(".sys_btn_wave")
.mouseenter(function (e) { var parentOffset = $(this)
.offset(); var relX = e.pageX - parentOffset.left; var relY = e.pageY - parentOffset.top;
$(this)
.find(".btn_wave_circle")
.css({ "left": relX, "top": relY });
$(this)
.find(".btn_wave_circle")
.removeClass("desplode-circle");
$(this)
.find(".btn_wave_circle")
.addClass("explode-circle"); });
$(".sys_btn_wave")
.mouseleave(function (e) { var parentOffset = $(this)
.offset(); var relX = e.pageX - parentOffset.left; var relY = e.pageY - parentOffset.top;
$(this)
.find(".btn_wave_circle")
.css({ "left": relX, "top": relY });
$(this)
.find(".btn_wave_circle")
.removeClass("explode-circle");
$(this)
.find(".btn_wave_circle")
.addClass("desplode-circle"); });
$(function () {
$('.sys_select_box .select_toggle')
.on('click', function (select) {
var selectBox = $(this)
.parents('.sys_select_box');
if (!selectBox.hasClass('active')) {
selectBox.addClass('active');
} else {
selectBox.removeClass('active');
}
select.stopPropagation();
})
$('.sys_select_box .select_menu')
.on('click', function (select) {
select.stopPropagation();
})
$(document)
.on('click', function (select) {
$('.sys_select_box')
.removeClass('active');
})
})