diff --git a/docs/index.html b/docs/index.html index 2ce9a2b3..99fd8c4d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1039,7 +1039,7 @@ } /* Support Browser-level image lazy loading of images */ - if (getURLParameterByName(['lazy-load-images', 'lazyLoadImages'], null, null, window.location.href, true) === 'true' ) { + if (getURLParameterByName(['lazy-load-images', 'lazyLoadImages'], null, null, window.location.href, true) === 'true') { htmlElement.innerHTML = htmlElement.innerHTML.replace(//g, function (match, p1) { if (p1.indexOf('loading=') === -1) { return match.replace('>', ' loading="lazy">'); @@ -1254,8 +1254,8 @@ // Build the current URL without the hash let currentUrlWithoutHash = new URL( - location.origin + location.pathname + - location.search + location.origin + location.pathname + + location.search ); // Get the search parameters from the URL (before the hash) @@ -1268,33 +1268,33 @@ // Check if the URL contains the 'id' query parameter in either search or hash if (isUrlHasIdQuery || isHashHasIdQuery) { - dd && console.log('url or hash has id, will scroll to element'); - - // Get the 'id' from either search or hash - let urlId = isUrlHasIdQuery ? urlQueryParam.get(TARGET_QUERY) : hashParams.get(TARGET_QUERY); - - // Delay the scrolling to ensure everything is loaded - setTimeout(function () { - dd && console.log('will scroll now!'); - try { - let targetElement = document.getElementById(urlId); // Use `getElementById` to directly reference the element - dd && console.log(urlId); - if (targetElement) { - // Use requestAnimationFrame for immediate scroll to the element - requestAnimationFrame(() => { - // Scroll smoothly to the element's top position - window.scrollTo({ - top: targetElement.offsetTop, - behavior: 'smooth' // Add smooth scrolling - }); - }); - } else { - dd && console.log('Element not found'); - } - } catch (e) { - dd && console.log('custom scroll failed', e); - } - }, SCROLL_DELAY); + dd && console.log('url or hash has id, will scroll to element'); + + // Get the 'id' from either search or hash + let urlId = isUrlHasIdQuery ? urlQueryParam.get(TARGET_QUERY) : hashParams.get(TARGET_QUERY); + + // Delay the scrolling to ensure everything is loaded + setTimeout(function () { + dd && console.log('will scroll now!'); + try { + let targetElement = document.getElementById(urlId); // Use `getElementById` to directly reference the element + dd && console.log(urlId); + if (targetElement) { + // Use requestAnimationFrame for immediate scroll to the element + requestAnimationFrame(() => { + // Scroll smoothly to the element's top position + window.scrollTo({ + top: targetElement.offsetTop, + behavior: 'smooth' // Add smooth scrolling + }); + }); + } else { + dd && console.log('Element not found'); + } + } catch (e) { + dd && console.log('custom scroll failed', e); + } + }, SCROLL_DELAY); } if (window.$docsify['basePath']) { @@ -1521,8 +1521,8 @@ ] } - - + // Credit to Beau Shaw for dymamic remote docsify technique + // To render a Markdown file named ** README.md ** (the expected default name) the URL would be https://hibbitts-design.github.io/test-docsify-project-docs/?basePath=https://raw.githubusercontent.com/hibbitts-design/docsify-open-course-starter-kit/main if (getURLParameterByName('basePath')) { const params = new URLSearchParams(window.location.search); params.forEach((value, key) => { @@ -1776,10 +1776,10 @@