mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-31 03:45:24 +01:00 
			
		
		
		
	footer: Fix broken anchor link scrolling (#64)
fixes: Footnotes anchor link hrefs such as `#fn:1` fixes: ToC anchors failing with hrefs having numbers. based-on: https://stackoverflow.com/a/51396346/300212
This commit is contained in:
		| @@ -30,8 +30,8 @@ | |||||||
|     document.querySelectorAll('a[href^="#"]').forEach(anchor => { |     document.querySelectorAll('a[href^="#"]').forEach(anchor => { | ||||||
|         anchor.addEventListener("click", function (e) { |         anchor.addEventListener("click", function (e) { | ||||||
|             e.preventDefault(); |             e.preventDefault(); | ||||||
|  |             var id = this.getAttribute("href").substr(1); | ||||||
|             document.querySelector(this.getAttribute("href")).scrollIntoView({ |             document.querySelector(`[id='${id}']`).scrollIntoView({ | ||||||
|                 behavior: "smooth" |                 behavior: "smooth" | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nick Spreitzer
					Nick Spreitzer