|
|
@ -3,12 +3,24 @@ var customSearch; |
|
|
|
(function ($) { |
|
|
|
(function ($) { |
|
|
|
|
|
|
|
|
|
|
|
"use strict"; |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校正页面定位(被导航栏挡住的区域)
|
|
|
|
var scrollCorrection = 80; // (header height = 64px) + (gap = 16px)
|
|
|
|
var scrollCorrection = 80; // (header height = 64px) + (gap = 16px)
|
|
|
|
const $headerAnchor = $('.l_header', '.cover-wrapper'); |
|
|
|
var $headerAnchor = $('.l_header', '.cover-wrapper'); |
|
|
|
if ($headerAnchor[0]) { |
|
|
|
if ($headerAnchor[0]) { |
|
|
|
scrollCorrection = $headerAnchor[0].clientHeight + 16; |
|
|
|
scrollCorrection = $headerAnchor[0].clientHeight + 16; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 尝试: 重设数据值
|
|
|
|
|
|
|
|
function restData() { |
|
|
|
|
|
|
|
scrollCorrection = 80; |
|
|
|
|
|
|
|
$headerAnchor = $('.l_header', '.cover-wrapper'); |
|
|
|
|
|
|
|
if ($headerAnchor[0]) { |
|
|
|
|
|
|
|
scrollCorrection = $headerAnchor[0].clientHeight + 16; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校正页面定位(被导航栏挡住的区域)
|
|
|
|
function scrolltoElement(elem, correction = scrollCorrection) { |
|
|
|
function scrolltoElement(elem, correction = scrollCorrection) { |
|
|
|
const $elem = elem.href ? $(elem.getAttribute('href')) : $(elem); |
|
|
|
const $elem = elem.href ? $(elem.getAttribute('href')) : $(elem); |
|
|
|
$('html, body').animate({ |
|
|
|
$('html, body').animate({ |
|
|
@ -16,19 +28,20 @@ var customSearch; |
|
|
|
}, 500); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置滚动锚点
|
|
|
|
function setScrollAnchor() { |
|
|
|
function setScrollAnchor() { |
|
|
|
// button
|
|
|
|
const $postsBtn = $('.menu .active'); // 一级导航上的当前激活的按钮
|
|
|
|
const $postsBtn = $('.menu .active'); |
|
|
|
const $topBtn = $('.s-top'); // 向上
|
|
|
|
const $topBtn = $('.s-top'); |
|
|
|
const $titleBtn = $('h1.title', '#header-meta'); // 文章内标题
|
|
|
|
const $titleBtn = $('h1.title', '#header-meta'); |
|
|
|
const $bodyAnchor = $('.l_body'); // 页面主体
|
|
|
|
// anchor
|
|
|
|
|
|
|
|
const $bodyAnchor = $('.l_body'); |
|
|
|
|
|
|
|
// action
|
|
|
|
|
|
|
|
if ($postsBtn.length && $bodyAnchor) { |
|
|
|
if ($postsBtn.length && $bodyAnchor) { |
|
|
|
$postsBtn.click(e => { |
|
|
|
$postsBtn.click(e => { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
if($postsBtn.attr("href") != "/") // TODO: fix it
|
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($titleBtn.length && $bodyAnchor) { |
|
|
|
if ($titleBtn.length && $bodyAnchor) { |
|
|
@ -36,6 +49,7 @@ var customSearch; |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($topBtn.length && $bodyAnchor) { |
|
|
|
if ($topBtn.length && $bodyAnchor) { |
|
|
@ -43,17 +57,32 @@ var customSearch; |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
scrolltoElement($bodyAnchor); |
|
|
|
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================
|
|
|
|
|
|
|
|
|
|
|
|
const $coverAnchor = $('.cover-wrapper'); |
|
|
|
const $coverAnchor = $('.cover-wrapper'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var enableCover = $('#pjax-enable-cover').text(); // Pjax 处理
|
|
|
|
|
|
|
|
|
|
|
|
var showHeaderPoint = 0; |
|
|
|
var showHeaderPoint = 0; |
|
|
|
if ($coverAnchor[0]) { |
|
|
|
if ($coverAnchor[0]) { |
|
|
|
|
|
|
|
if(enableCover == "true" && $('.cover.half').css('display') !== 'none') // Pjax 处理
|
|
|
|
showHeaderPoint = $coverAnchor[0].clientHeight - 180;
|
|
|
|
showHeaderPoint = $coverAnchor[0].clientHeight - 180;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var pos = document.body.scrollTop; |
|
|
|
var pos = document.body.scrollTop; |
|
|
|
|
|
|
|
if(enableCover == "true" && $('.cover.half').css('display') === 'none') |
|
|
|
|
|
|
|
pos += 180; // Pjax 处理
|
|
|
|
|
|
|
|
|
|
|
|
$(document, window).scroll(() => { |
|
|
|
$(document, window).scroll(() => { |
|
|
|
const scrollTop = $(window).scrollTop(); |
|
|
|
let scrollTop = $(window).scrollTop(); // 滚动条距离顶部的距离
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(enableCover == "true" && $('.cover.half').css('display') === 'none') |
|
|
|
|
|
|
|
scrollTop += 180; // Pjax 处理
|
|
|
|
|
|
|
|
|
|
|
|
const del = scrollTop - pos; |
|
|
|
const del = scrollTop - pos; |
|
|
|
pos = scrollTop; |
|
|
|
pos = scrollTop; |
|
|
|
if (scrollTop > 180) { |
|
|
|
if (scrollTop > 180) { |
|
|
@ -72,15 +101,27 @@ var customSearch; |
|
|
|
$headerAnchor.removeClass('show'); |
|
|
|
$headerAnchor.removeClass('show'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//==========================================
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置导航栏
|
|
|
|
function setHeader() { |
|
|
|
function setHeader() { |
|
|
|
|
|
|
|
var HEXO_ISPAGE = $.trim($('#pjax-ispage').text()); |
|
|
|
|
|
|
|
if(HEXO_ISPAGE == 'true') |
|
|
|
|
|
|
|
window.subData = { |
|
|
|
|
|
|
|
title: $.trim($('#pjax-pageTitle').text()), |
|
|
|
|
|
|
|
tools: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!window.subData) return; |
|
|
|
if (!window.subData) return; |
|
|
|
const $wrapper = $('header .wrapper'); |
|
|
|
const $wrapper = $('header .wrapper'); // 整个导航栏
|
|
|
|
const $comment = $('.s-comment', $wrapper); |
|
|
|
const $comment = $('.s-comment', $wrapper); // 评论按钮 桌面端 移动端
|
|
|
|
const $toc = $('.s-toc', $wrapper); |
|
|
|
const $toc = $('.s-toc', $wrapper); // 目录按钮 仅移动端
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$comment.show(); // 显示 (某些文章可能关闭了评论,故先行显示)
|
|
|
|
|
|
|
|
$wrapper.find('.nav-sub .title').text(window.subData.title); // 二级导航文章标题
|
|
|
|
|
|
|
|
|
|
|
|
$wrapper.find('.nav-sub .title').text(window.subData.title); |
|
|
|
// 决定一二级导航栏的切换
|
|
|
|
let pos = document.body.scrollTop; |
|
|
|
let pos = document.body.scrollTop; |
|
|
|
$(document, window).scroll(() => { |
|
|
|
$(document, window).scroll(() => { |
|
|
|
const scrollTop = $(window).scrollTop(); |
|
|
|
const scrollTop = $(window).scrollTop(); |
|
|
@ -90,21 +131,22 @@ var customSearch; |
|
|
|
$wrapper.addClass('sub'); |
|
|
|
$wrapper.addClass('sub'); |
|
|
|
} else if (del <= -50) { |
|
|
|
} else if (del <= -50) { |
|
|
|
pos = scrollTop; |
|
|
|
pos = scrollTop; |
|
|
|
$wrapper.removeClass('sub'); |
|
|
|
$wrapper.removeClass('sub'); // <---- 取消二级导航显示
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// bind events to every btn
|
|
|
|
// bind events to every btn
|
|
|
|
const $commentTarget = $('.l_body .comments'); |
|
|
|
let $commentTarget = $('.l_body .comments'); // 评论区域
|
|
|
|
if ($commentTarget.length) { |
|
|
|
if ($commentTarget.length) { |
|
|
|
$comment.click(e => { |
|
|
|
$comment.click(e => { // 评论按钮点击后 跳转到评论区域
|
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
scrolltoElement($commentTarget); |
|
|
|
scrolltoElement($('.l_body .comments')); |
|
|
|
|
|
|
|
e.stopImmediatePropagation(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else $comment.remove(); |
|
|
|
} else $comment.hide(); // 关闭了评论,则隐藏
|
|
|
|
|
|
|
|
|
|
|
|
const $tocTarget = $('.l_body .toc-wrapper'); |
|
|
|
const $tocTarget = $('.l_body .toc-wrapper'); // 侧边栏的目录列表 PC
|
|
|
|
if ($tocTarget.length && $tocTarget.children().length) { |
|
|
|
if ($tocTarget.length && $tocTarget.children().length) { |
|
|
|
$toc.click((e) => { |
|
|
|
$toc.click((e) => { |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
@ -112,6 +154,7 @@ var customSearch; |
|
|
|
$toc.toggleClass('active'); |
|
|
|
$toc.toggleClass('active'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
$(document).click(function (e) { |
|
|
|
$(document).click(function (e) { |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
$tocTarget.removeClass('active'); |
|
|
|
$tocTarget.removeClass('active'); |
|
|
|
$toc.removeClass('active'); |
|
|
|
$toc.removeClass('active'); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -120,11 +163,9 @@ var customSearch; |
|
|
|
$toc.removeClass('active'); |
|
|
|
$toc.removeClass('active'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else $toc.remove(); |
|
|
|
} else $toc.remove(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置导航栏菜单选中状态
|
|
|
|
function setHeaderMenuSelection() { |
|
|
|
function setHeaderMenuSelection() { |
|
|
|
var $headerMenu = $('body .navigation'); |
|
|
|
var $headerMenu = $('body .navigation'); |
|
|
|
// 先把已经激活的取消激活
|
|
|
|
// 先把已经激活的取消激活
|
|
|
@ -159,39 +200,23 @@ var customSearch; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setHeaderMenuPhone() { |
|
|
|
// 设置导航栏搜索框 fix √
|
|
|
|
// var $switcher = $('.l_header .switcher .s-menu');
|
|
|
|
|
|
|
|
// var $menu = $('body .menu-phone');
|
|
|
|
|
|
|
|
// $switcher.click(function (e) {
|
|
|
|
|
|
|
|
// e.stopPropagation();
|
|
|
|
|
|
|
|
// $menu.toggleClass('show');
|
|
|
|
|
|
|
|
// $switcher.toggleClass('active');
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// $(document).click(function (e) {
|
|
|
|
|
|
|
|
// // $menu.removeClass('show');
|
|
|
|
|
|
|
|
// $switcher.removeClass('active');
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// $(document, window).scroll(() => {
|
|
|
|
|
|
|
|
// $menu.removeClass('show');
|
|
|
|
|
|
|
|
// $switcher.removeClass('active');
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setHeaderSearch() { |
|
|
|
function setHeaderSearch() { |
|
|
|
var $switcher = $('.l_header .switcher .s-search'); |
|
|
|
var $switcher = $('.l_header .switcher .s-search'); // 搜索按钮 移动端
|
|
|
|
var $header = $('.l_header'); |
|
|
|
var $header = $('.l_header'); // 移动端导航栏
|
|
|
|
var $search = $('.l_header .m_search'); |
|
|
|
var $search = $('.l_header .m_search'); // 搜索框 桌面端
|
|
|
|
if ($switcher.length === 0) return; |
|
|
|
if ($switcher.length === 0) return; |
|
|
|
$switcher.click(function (e) { |
|
|
|
$switcher.click(function (e) { |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
$header.toggleClass('z_search-open'); |
|
|
|
$header.toggleClass('z_search-open'); // 激活移动端搜索框
|
|
|
|
|
|
|
|
$switcher.toggleClass('active'); // 搜索按钮
|
|
|
|
$search.find('input').focus(); |
|
|
|
$search.find('input').focus(); |
|
|
|
$switcher.toggleClass('active'); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
$(document).click(function (e) { |
|
|
|
$(document).click(function (e) { |
|
|
|
$header.removeClass('z_search-open'); |
|
|
|
$header.removeClass('z_search-open'); |
|
|
|
$switcher.removeClass('active'); |
|
|
|
$switcher.removeClass('active'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$search.click(function (e) { |
|
|
|
$search.click(function (e) { |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -224,8 +249,9 @@ var customSearch; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置导航栏搜索框
|
|
|
|
function setTocToggle() { |
|
|
|
function setTocToggle() { |
|
|
|
const $toc = $('.toc-wrapper'); |
|
|
|
const $toc = $('.toc-wrapper'); // 侧边栏 TOC 移动端
|
|
|
|
if ($toc.length === 0) return; |
|
|
|
if ($toc.length === 0) return; |
|
|
|
$toc.click((e) => { |
|
|
|
$toc.click((e) => { |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
@ -248,13 +274,19 @@ var customSearch; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const liElements = Array.from($toc.find('li a')); |
|
|
|
let liElements = Array.from($toc.find('li a')); |
|
|
|
//function animate above will convert float to int.
|
|
|
|
//function animate above will convert float to int.
|
|
|
|
const getAnchor = () => liElements.map(elem => Math.floor($(elem.getAttribute('href')).offset().top - scrollCorrection)); |
|
|
|
let getAnchor = () => liElements.map(elem => Math.floor($(elem.getAttribute('href')).offset().top - scrollCorrection)); |
|
|
|
|
|
|
|
|
|
|
|
let anchor = getAnchor(); |
|
|
|
let anchor = getAnchor(); |
|
|
|
const scrollListener = () => { |
|
|
|
let domHeigth = $(document).height(); |
|
|
|
const scrollTop = $('html').scrollTop() || $('body').scrollTop(); |
|
|
|
let scrollListener = () => { |
|
|
|
|
|
|
|
let scrollTop = $('html').scrollTop() || $('body').scrollTop(); |
|
|
|
|
|
|
|
if ($(document).height() != domHeigth) { // dom 高度发生变化: 普遍来说,是图片懒加载造成的
|
|
|
|
|
|
|
|
scrollTop = $('html').scrollTop() || $('body').scrollTop(); |
|
|
|
|
|
|
|
domHeigth = $(document).height(); |
|
|
|
|
|
|
|
anchor = getAnchor(); |
|
|
|
|
|
|
|
} |
|
|
|
if (!anchor) return; |
|
|
|
if (!anchor) return; |
|
|
|
//binary search.
|
|
|
|
//binary search.
|
|
|
|
let l = 0, |
|
|
|
let l = 0, |
|
|
@ -267,18 +299,26 @@ var customSearch; |
|
|
|
else r = mid - 1; |
|
|
|
else r = mid - 1; |
|
|
|
} |
|
|
|
} |
|
|
|
$(liElements).removeClass('active').eq(l).addClass('active'); |
|
|
|
$(liElements).removeClass('active').eq(l).addClass('active'); |
|
|
|
} |
|
|
|
}; |
|
|
|
$(window) |
|
|
|
|
|
|
|
.resize(() => { |
|
|
|
$(window).scroll(() => { |
|
|
|
|
|
|
|
scrollListener(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听窗口改变事件
|
|
|
|
|
|
|
|
let resizeTimer = null; |
|
|
|
|
|
|
|
$(window).bind('resize', function (){ |
|
|
|
|
|
|
|
if (resizeTimer) clearTimeout(resizeTimer); |
|
|
|
|
|
|
|
resizeTimer = setTimeout(function(){ |
|
|
|
anchor = getAnchor(); |
|
|
|
anchor = getAnchor(); |
|
|
|
scrollListener(); |
|
|
|
scrollListener(); |
|
|
|
}) |
|
|
|
} , 100); |
|
|
|
.scroll(() => { |
|
|
|
|
|
|
|
scrollListener() |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
scrollListener(); |
|
|
|
scrollListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置搜索服务
|
|
|
|
function setSearchService() { |
|
|
|
function setSearchService() { |
|
|
|
if (SEARCH_SERVICE === 'google') { |
|
|
|
if (SEARCH_SERVICE === 'google') { |
|
|
|
customSearch = new GoogleCustomSearch({ |
|
|
|
customSearch = new GoogleCustomSearch({ |
|
|
@ -312,6 +352,7 @@ var customSearch; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置 tabs 标签
|
|
|
|
function setTabs() { |
|
|
|
function setTabs() { |
|
|
|
const $tabs = $('.tabs'); |
|
|
|
const $tabs = $('.tabs'); |
|
|
|
if ($tabs.length === 0) return; |
|
|
|
if ($tabs.length === 0) return; |
|
|
@ -336,19 +377,45 @@ var customSearch; |
|
|
|
$(function () { |
|
|
|
$(function () { |
|
|
|
setHeader(); |
|
|
|
setHeader(); |
|
|
|
setHeaderMenuSelection(); |
|
|
|
setHeaderMenuSelection(); |
|
|
|
setHeaderMenuPhone(); |
|
|
|
|
|
|
|
setHeaderSearch(); |
|
|
|
setHeaderSearch(); |
|
|
|
setTocToggle(); |
|
|
|
setTocToggle(); |
|
|
|
setScrollAnchor(); |
|
|
|
setScrollAnchor(); |
|
|
|
setSearchService(); |
|
|
|
setSearchService(); |
|
|
|
setTabs(); |
|
|
|
setTabs(); |
|
|
|
// $(".article .video-container").fitVids();
|
|
|
|
|
|
|
|
|
|
|
|
// 全屏封面底部箭头
|
|
|
|
$('.scroll-down').on('click', function () { |
|
|
|
$('.scroll-down').on('click', function () { |
|
|
|
scrolltoElement('.l_body'); |
|
|
|
scrolltoElement('.l_body'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
setTimeout(function () { |
|
|
|
|
|
|
|
$('#loading-bar-wrapper').fadeOut(500); |
|
|
|
|
|
|
|
}, 300); |
|
|
|
// addEventListener是先绑定先执行,此处的绑定后执行
|
|
|
|
|
|
|
|
document.addEventListener('pjax:complete', function () { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$(function () { |
|
|
|
|
|
|
|
restData(); |
|
|
|
|
|
|
|
setHeader(); |
|
|
|
|
|
|
|
setHeaderMenuSelection(); |
|
|
|
|
|
|
|
setTocToggle(); |
|
|
|
|
|
|
|
setScrollAnchor(); |
|
|
|
|
|
|
|
setTabs(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.log(error); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery); |
|
|
|
})(jQuery); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*Valine Admin*/ |
|
|
|
|
|
|
|
if(window.location.hash){ |
|
|
|
|
|
|
|
var checkExist = setInterval(function() { |
|
|
|
|
|
|
|
if (typeof jQuery == 'undefined'){return;} |
|
|
|
|
|
|
|
if ($("#"+window.location.hash.split("#")[1]).length) { |
|
|
|
|
|
|
|
$('html, body').animate({scrollTop: $("#"+window.location.hash.split("#")[1]).offset().top-90}, 1000); |
|
|
|
|
|
|
|
clearInterval(checkExist); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, 100); |
|
|
|
|
|
|
|
} |