AdaptText
A flexible modern adapt-text js plugin.
Introduction
Installation
Yarn
yarn add @pluginjs/adapt-text
NPM
npm i @pluginjs/adapt-text
Getting Started
CDN:
Development:
<script src="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.css">
Production:
<script src="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.min.css">
Initialize
HTML:
<div class="element"></div>
ECMAScript Module:
import AdaptText from "@pluginjs/adapt-text"
import "@pluginjs/adapt-text/dist/adapt-text.css"
AdaptText.of(document.querySelector('.element'), options)
CommonJS:
require("@pluginjs/adapt-text/dist/adapt-text.css")
const AdaptText = require("@pluginjs/adapt-text")
AdaptText.of(document.querySelector('.element'), options)
Browser:
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.css">
<script src="https://unpkg.com/@pluginjs/adapt-text/dist/adapt-text.js"></script>
<script>
Pj.adaptText('.element', options)
</script>
API
Options
Options are called on adaptText instances through the adaptText options itself. You can also save the instances to variable for further use.
Name | Description | Default |
---|---|---|
"ratio" |
AdaptText ratio value | 10 |
"max" |
Max value | Infinity |
"min" |
Min value | -Infinity |
"scrollable" |
Can be scroll or not | false |
"scrollSpeed" |
factor of scroll speed | 1200 |
"scrollResetSpeed" |
Reset threshold of scroll speed | 300 |
"resize" |
Can be resize or not | true |
Events
Events are called on adaptText instances through the adaptText events itself. You can also save the instances to variable for further use.
Name | Description |
---|---|
"ready" |
Gets fired when plugin is ready |
"enable" |
Gets fired when plugin is enabled |
"disable" |
Gets fired when plugin is disabled |
"destroy" |
Gets fired when plugin is destroy |
Methods
Methods are called on adaptText instances through the adaptText method itself. You can also save the instances to variable for further use.
Name | Description |
---|---|
"enable" |
Enabled plugin if plugin is disabled |
"disable" |
Disable plugin |
"destroy" |
Destroy plugin |
"resize" |
Resize handle |
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/adapt-text is Licensed under the GPL-v3 license.
If you want to use @pluginjs/adapt-text 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.