Giter Club home page Giter Club logo

smooths's Introduction

alt text

SMOOTHS

A VERY LIGHTWEIGHT (~1KB) SCRIPT THAT ASSISTS SMOOTH SCROLLING

View the demo

View the demo on Codepen


Getting Started

Compiled code for production can be found in the dist directory. The src directory contains development code.

1. Include Smooths

<script src="dist/js/smooths-min.js"></script>

2. Add the markup to your HTML.

No special markup needed, just standard anchor links. Give the anchor location an ID just like you normally would.

<a href="#section-one" class="link">Section 1</a>
...
<div id="section-one" class="scroll-section"></div> 

3. Initialize Smooths

In the footer of your page, after the content, initialize Smooths by passing in a selector for the anchor links that should be animated.

<script>
var smooths = new smooths({  //  Initialize Smooths
	section: 'scroll-section',
	anchor: 'link'
});
</script>

Options and Settings

Speed

You can set the speed of animation.

var smooths = new smooths({
	speed: 200
);

The default speed value is 200 (2s) specifies the number of milliseconds it takes to scroll to the specified area

Easing Options

For now only linear easing is supported.

Linear Moves at the same speed from start to finish.

  • Linear

About

Smooths is a very lightweight (~ 1KB) script that assists smooth scrolling to anchor links, written with vanilla JavaScript, created by Milan Milosev

How it's work?

By clicking on the link will animate scrolling to a specific section on the page.

smooths's People

Stargazers

 avatar

Watchers

 avatar

smooths's Issues

hamburger menu not close

In mobile view , click the menu item, it scrolls well but hamburger menu will not close, this menu will cover the section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.