Skip to content

hescobari/scroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scroll to class

This vertical scroll code was done in pure javascript

Repository

This repository contains a example of the vertical scroll funtion, only is necesary to clone the repository and run index.html

Include to your project

Only is necesary to copy the scroll.js file into your project and include the scroll.js in your html or javascript file

HTML
<script type="text/javascript" src='./scroll.js'></script>
Javascript
import './scroll.js';

Usage

To usage you have to add in the href attribute of the link (tag: a), the class name of the element that you want to point and assign the function to the link

HTML
<a id='home_link' href='#home'></a>
Javascript
const element = document.getElementById('home_link');
element.onclick = (e) => 
{
    e.preventDefault();
    scrollTo('home');
}

License

MIT

About

Pure javascript vertical scroll

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors