SectionScroll
A flexible modern section-scroll js plugin.
Introduction
Installation
Yarn
yarn add @pluginjs/section-scroll
NPM
npm i @pluginjs/section-scroll
Getting Started
CDN:
Development:
<script src="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.css">
Production:
<script src="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.min.css">
Initialize
HTML:
<div class="element"></div>
ECMAScript Module:
import SectionScroll from "@pluginjs/section-scroll"
import "@pluginjs/section-scroll/dist/section-scroll.css"
SectionScroll.of(document.querySelector('.element'), options)
CommonJS:
require("@pluginjs/section-scroll/dist/section-scroll.css")
const SectionScroll = require("@pluginjs/section-scroll")
SectionScroll.of(document.querySelector('.element'), options)
Browser:
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.css">
<script src="https://unpkg.com/@pluginjs/section-scroll/dist/section-scroll.js"></script>
<script>
Pj.sectionScroll('.element', options)
</script>
API
Options
Options are called on sectionScroll instances through the sectionScroll options itself. You can also save the instances to variable for further use.
Name | Description | Default |
---|---|---|
"itemSelector" |
Set itemSelector | `` |
"titleSelector" |
Set titleSelector | `` |
"animation" |
Set animation | scroll |
"duration" |
Set duretion | `` |
"easing" |
Set easing | `` |
"touch" |
Set touch | true |
"mousewheel" |
Set mousewheel | true |
"touchSensitivity" |
Set touchSensitivity | 5 |
"dots" |
Set dots | {"theme":null,"items":null,"default":null,"direction":"vertical","valueFrom":"data-href","template":{}} |
"template" |
Set default template | function() {...} |
Events
Events are called on sectionScroll instances through the sectionScroll events itself. You can also save the instances to variable for further use.
Name | Description |
---|---|
"destroy" |
Gets fired when plugin has destroy |
"change" |
Gets fired when plugin has changed |
"ready" |
Gets fired when plugin has ready |
"enable" |
Gets fired when plugin has enabled |
"disable" |
Gets fired when plugin has disabled |
Methods
Methods are called on sectionScroll instances through the sectionScroll method itself. You can also save the instances to variable for further use.
Name | Description |
---|---|
"destroy" |
Destroy plugin |
"next" |
Set next function |
"previous" |
Set previous function |
"goTo" |
Set value of goTo |
"scrollTo" |
Set value of scrollTo |
"getId" |
Set value of getId |
"enable" |
Enabled plugin if plugin is disabled |
"disable" |
Disable plugin |
Classes
Name | Description | Default
--||
"NAMESPACE"
| Declare plugin namespace | pj-sectionScroll
"DOTS"
| Declare plugin dots | {namespace}-dots
"SECTION"
| Declare plugin section | {namespace}-section
"CONTAINER"
| Declare plugin range | {namespace}-container
"OPEN"
| Declare plugin open | {namespace}-open
"DISABLED"
| Announce plugin is disabled | {namespace}-disabled
Browser support
Tested on all major browsers.
IE / Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
License
@pluginjs/section-scroll is Licensed under the GPL-v3 license.
If you want to use @pluginjs/section-scroll project to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary.
For purchase an Commercial License, contact us purchase@thecreation.co.
Copyright
Copyright (C) 2022 Creation Studio Limited.