|
|
@ -8,7 +8,7 @@ var customSearch; |
|
|
|
if ($headerAnchor[0]) { |
|
|
|
if ($headerAnchor[0]) { |
|
|
|
scrollCorrection = $headerAnchor[0].clientHeight + 16; |
|
|
|
scrollCorrection = $headerAnchor[0].clientHeight + 16; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function scrolltoElement(elem, correction) { |
|
|
|
function scrolltoElement(elem, correction) { |
|
|
|
correction = correction || scrollCorrection; |
|
|
|
correction = correction || scrollCorrection; |
|
|
|
const $elem = elem.href ? $(elem.getAttribute('href')) : $(elem); |
|
|
|
const $elem = elem.href ? $(elem.getAttribute('href')) : $(elem); |
|
|
@ -19,12 +19,17 @@ var customSearch; |
|
|
|
// button
|
|
|
|
// button
|
|
|
|
const $postsBtn = $('.menu .active'); |
|
|
|
const $postsBtn = $('.menu .active'); |
|
|
|
const $topBtn = $('.s-top'); |
|
|
|
const $topBtn = $('.s-top'); |
|
|
|
|
|
|
|
const $titleBtn = $('h1.title', '#header-meta'); |
|
|
|
|
|
|
|
console.log($titleBtn); |
|
|
|
// anchor
|
|
|
|
// anchor
|
|
|
|
const $bodyAnchor = $('.l_body'); |
|
|
|
const $bodyAnchor = $('.l_body'); |
|
|
|
// action
|
|
|
|
// action
|
|
|
|
if ($postsBtn.length && $bodyAnchor) { |
|
|
|
if ($postsBtn.length && $bodyAnchor) { |
|
|
|
$postsBtn.click(e => { e.preventDefault(); e.stopPropagation(); scrolltoElement($bodyAnchor); }); |
|
|
|
$postsBtn.click(e => { e.preventDefault(); e.stopPropagation(); scrolltoElement($bodyAnchor); }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($titleBtn.length && $bodyAnchor) { |
|
|
|
|
|
|
|
$titleBtn.click(e => { e.preventDefault(); e.stopPropagation(); scrolltoElement($bodyAnchor); }); |
|
|
|
|
|
|
|
} |
|
|
|
if ($topBtn.length && $bodyAnchor) { |
|
|
|
if ($topBtn.length && $bodyAnchor) { |
|
|
|
$topBtn.click(e => { e.preventDefault(); e.stopPropagation(); scrolltoElement($bodyAnchor); }); |
|
|
|
$topBtn.click(e => { e.preventDefault(); e.stopPropagation(); scrolltoElement($bodyAnchor); }); |
|
|
|
} |
|
|
|
} |
|
|
|