mirror of
				https://github.com/RetroDECK/RetroDECK.git
				synced 2025-04-10 19:15:12 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			10 lines
		
	
	
		
			391 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
		
			391 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| //add smooth scrolling when clicking any anchor link
 | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => {
 | |
|     anchor.addEventListener('click', function (e) {
 | |
|         e.preventDefault();
 | |
|         document.querySelector(this.getAttribute('href')).scrollIntoView({
 | |
|             behavior: 'smooth'
 | |
|         });
 | |
|     });
 | |
| });
 | |
| //<a href="#someOtherElementID"> Go to Other Element Smoothly </a>
 |