Only use jQuery animate if native smooth scrolling is not supported

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2023-04-10 00:06:04 +02:00
parent ca1b4954fc
commit 2d2190f8f0
3 changed files with 21 additions and 10 deletions

View file

@ -30,15 +30,23 @@ var $sitehead = $("#site-head");
}
}
$(document).ready(function () {
$("a.btn.site-menu").click(function (e) {
e.preventDefault();
srcToAnchorWithTitle($(e.target).data("title-anchor"));
});
$("#header-arrow").click(function () {
srcTo($first);
});
// fallback to jQuery animate if smooth scrolling is not supported
if (!"scrollBehavior" in document.documentElement.style) {
// Cover buttons
$("a.btn.site-menu").click(function (e) {
e.preventDefault();
srcToAnchorWithTitle($(e.target).data("title-anchor"));
});
// cover arrow button
$("#header-arrow").click(function (e) {
e.preventDefault()
srcTo($first);
});
}
$(".post.last").next(".post-after").hide();
if ($sitehead.length) {
$(window).scroll(function () {
var w = $(window).scrollTop();