From 2873d1527bcae697eef951eb32f8e7baa74e28ed Mon Sep 17 00:00:00 2001 From: Sanjay Singh Bisht <sanjaysinghbisht114@gmail.com> Date: Tue, 25 May 2021 22:55:49 +0530 Subject: [PATCH] Commented scroll-behavior: smooth at line 48 in css/custom.css. Added javascript code in index.html from line 460 to 498 --- css/custom.css | 2 +- index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/css/custom.css b/css/custom.css index 18b0d81..b752bc1 100644 --- a/css/custom.css +++ b/css/custom.css @@ -45,7 +45,7 @@ } html{ - scroll-behavior: smooth; + /* scroll-behavior: smooth; */ } body { diff --git a/index.html b/index.html index f8c8592..136ca21 100644 --- a/index.html +++ b/index.html @@ -456,6 +456,48 @@ $('.first-button').on('click', function () { $('.animated-icon').toggleClass('open'); }); + +// added code to resolve safari smooth scrolling error + + $('a[href*="#"]') + // Remove links that don't actually link to anything + .not('[href="#"]') + .not('[href="#0"]') + .click(function(event) { + // On-page links + if ( + location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') + && + location.hostname == this.hostname + ) { + // Figure out element to scroll to + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); + // Does a scroll target exist? + if (target.length) { + // Only prevent default if animation is actually gonna happen + event.preventDefault(); + $('html, body').animate({ + scrollTop: target.offset().top + }, 1000, function() { + // Callback after animation + // Must change focus! + var $target = $(target); + $target.focus(); + if ($target.is(":focus")) { // Checking if the target was focused + return false; + } else { + $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable + $target.focus(); // Set focus again + }; + }); + } + } + }); + +// end of added code + + }); if('serviceWorker' in navigator) { navigator.serviceWorker.register('/service_worker.js') @@ -474,6 +516,12 @@ }; return t; }(document, "script", "twitter-wjs")); + + + + + + </script> <script src="scripts/meetupAPI.js"></script> </body> -- GitLab