|
|
|
@ -49,47 +49,47 @@ var customSearch; |
|
|
|
|
$top.click(()=>scrolltoElement(document.body)); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function setHeaderMenu() { |
|
|
|
|
var $headerMenu = $('header .menu'); |
|
|
|
|
var $underline = $headerMenu.find('.underline'); |
|
|
|
|
function setUnderline($item, transition) { |
|
|
|
|
$item = $item || $headerMenu.find('li a.active');//get instant
|
|
|
|
|
transition = transition === undefined ? true : !!transition; |
|
|
|
|
if (!transition) $underline.addClass('disable-trans'); |
|
|
|
|
if ($item && $item.length) { |
|
|
|
|
$item.addClass('active').siblings().removeClass('active'); |
|
|
|
|
$underline.css({ |
|
|
|
|
left: $item.position().left, |
|
|
|
|
width: $item.innerWidth() |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
$underline.css({ |
|
|
|
|
left: 0, |
|
|
|
|
width: 0 |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if (!transition) { |
|
|
|
|
setTimeout(function () { $underline.removeClass('disable-trans') }, 0);//get into the queue.
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// $headerMenu.on('mouseenter', 'li', function (e) {
|
|
|
|
|
// setUnderline($(e.currentTarget));
|
|
|
|
|
// });
|
|
|
|
|
// $headerMenu.on('mouseout', function () {
|
|
|
|
|
// setUnderline();
|
|
|
|
|
// });
|
|
|
|
|
//set current active nav
|
|
|
|
|
var $active_link = null; |
|
|
|
|
if (location.pathname === '/' || location.pathname.startsWith('/page/')) { |
|
|
|
|
$active_link = $('.nav-home', $headerMenu); |
|
|
|
|
} else { |
|
|
|
|
var name = location.pathname.match(/\/(.*?)\//); |
|
|
|
|
if (name.length > 1) { |
|
|
|
|
$active_link = $('.nav-' + name[1], $headerMenu); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
setUnderline($active_link, false); |
|
|
|
|
} |
|
|
|
|
// function setHeaderMenu() {
|
|
|
|
|
// var $headerMenu = $('header .menu');
|
|
|
|
|
// var $underline = $headerMenu.find('.underline');
|
|
|
|
|
// function setUnderline($item, transition) {
|
|
|
|
|
// $item = $item || $headerMenu.find('li a.active');//get instant
|
|
|
|
|
// transition = transition === undefined ? true : !!transition;
|
|
|
|
|
// if (!transition) $underline.addClass('disable-trans');
|
|
|
|
|
// if ($item && $item.length) {
|
|
|
|
|
// $item.addClass('active').siblings().removeClass('active');
|
|
|
|
|
// $underline.css({
|
|
|
|
|
// left: $item.position().left,
|
|
|
|
|
// width: $item.innerWidth()
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// $underline.css({
|
|
|
|
|
// left: 0,
|
|
|
|
|
// width: 0
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (!transition) {
|
|
|
|
|
// setTimeout(function () { $underline.removeClass('disable-trans') }, 0);//get into the queue.
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // $headerMenu.on('mouseenter', 'li', function (e) {
|
|
|
|
|
// // setUnderline($(e.currentTarget));
|
|
|
|
|
// // });
|
|
|
|
|
// // $headerMenu.on('mouseout', function () {
|
|
|
|
|
// // setUnderline();
|
|
|
|
|
// // });
|
|
|
|
|
// //set current active nav
|
|
|
|
|
// var $active_link = null;
|
|
|
|
|
// if (location.pathname === '/' || location.pathname.startsWith('/page/')) {
|
|
|
|
|
// $active_link = $('.nav-home', $headerMenu);
|
|
|
|
|
// } else {
|
|
|
|
|
// var name = location.pathname.match(/\/(.*?)\//);
|
|
|
|
|
// if (name.length > 1) {
|
|
|
|
|
// $active_link = $('.nav-' + name[1], $headerMenu);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// setUnderline($active_link, false);
|
|
|
|
|
// }
|
|
|
|
|
function setHeaderMenuPhone() { |
|
|
|
|
var $switcher = $('.l_header .switcher .s-menu'); |
|
|
|
|
$switcher.click(function (e) { |
|
|
|
@ -214,7 +214,7 @@ var customSearch; |
|
|
|
|
$(function () { |
|
|
|
|
//set header
|
|
|
|
|
setHeader(); |
|
|
|
|
setHeaderMenu(); |
|
|
|
|
// setHeaderMenu();
|
|
|
|
|
setHeaderMenuPhone(); |
|
|
|
|
setHeaderSearch(); |
|
|
|
|
setWaves(); |
|
|
|
|