You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
i was cleaning a site a bit up and noticed that when i use the links to references on other pages, smoothScroll is added in the url path. Did a simple fix for that.
How it was
After the fix
Adjusted code
$(document).ready(function () {
// Call $.smoothScroll if location.hash starts with "#smoothScroll"
//var reSmooth = /^#smoothScroll/;
var reSmooth = /^#smoothScroll/;
var tag = /^#/;
var id;
if (reSmooth.test(location.hash)){
// ADD FOCUS FOR TAG
id = '#' + location.hash.replace(reSmooth, '');
$(id).css('border-bottom', '4px solid #00aeef');
$(id).css('padding-bottom', '1px');
}
if (reSmooth.test(location.hash)) {
// Strip the "#smoothScroll" part off (and put "#" back on the beginning)
id = '#' + location.hash.replace(reSmooth, '');
// Strip the "#smoothScroll" part off path
location.hash = location.hash.replace(reSmooth, '');
$.smoothScroll({
scrollTarget: id,
offset: -100
});
}
else if (tag.test(location.hash)) {
// Strip the "#smoothScroll" part off (and put "#" back on the beginning)
id = location.hash;
// Strip the "#smoothScroll" part off path
location.hash = location.hash.replace(reSmooth, '');
$.smoothScroll({
scrollTarget: id,
offset: -100
});
}
});
The text was updated successfully, but these errors were encountered:
schroef
changed the title
Strip SmoothScrool from urlPath
Strip smoothScroll from urlPath
Mar 3, 2020
Hi there,
i was cleaning a site a bit up and noticed that when i use the links to references on other pages, smoothScroll is added in the url path. Did a simple fix for that.
How it was
After the fix
Adjusted code
The text was updated successfully, but these errors were encountered: