Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/StaticMania/portio-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/script.js')
-rw-r--r--assets/js/script.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/assets/js/script.js b/assets/js/script.js
index 7e7f1aa..9123063 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -69,13 +69,16 @@ $(document).ready(function () {
// Smooth scrolling
var scrollLink = $(".scroll");
scrollLink.click(function (e) {
- e.preventDefault();
- $("body,html").animate(
- {
- scrollTop: $(this.hash).offset().top,
- },
- 1000
- );
+ let elem = $(this.hash)
+ if (elem.length) {
+ e.preventDefault();
+ $("body,html").animate(
+ {
+ scrollTop: elem.offset().top,
+ },
+ 1000
+ );
+ }
});
$(".navbar-nav>li>a").on("click", function () {