Package Manager Installation
Install Tiny Slider using your preferred package manager:The package includes both source files (in
src/) and built distribution files (in dist/).CDN Installation
For quick prototyping or simple projects, you can use a CDN to include Tiny Slider:CSS
Add the Tiny Slider stylesheet to your page:JavaScript
Add the Tiny Slider JavaScript file:Prior to v2.2.1, the
tiny-slider.js script needed to be placed inside the <body> tag. From v2.2.1 onwards, you can include it in the <head> or <body>.Alternative CDN
Tiny Slider is also available on jsDelivr:Manual Installation
You can also download the files directly from the GitHub repository:Download the repository
Download from github.com/ganlanyuan/tiny-slider
Required Files
CSS File
The CSS file is required for Tiny Slider to work correctly. It includes styles for:- Slide positioning and transitions
- Controls (prev/next buttons)
- Navigation dots
- Autoplay button
- Responsive behavior
Internet Explorer 8 Support
If you need to support IE8, you must include the IE8 polyfills helper file:Object.keysChildNode.removeaddEventListenerArray.prototype.forEachArray.prototype.mapArray.prototype.filterArray.prototype.indexOfArray.isArrayElement.prototype.firstElementChildElement.prototype.lastElementChildElement.prototype.nextElementSiblingElement.prototype.previousElementSiblingwindow.getComputedStyle
The conditional comment syntax
<!--[if (lt IE 9)]> ensures that the polyfills are only loaded in IE8 and below, avoiding unnecessary downloads for modern browsers.TypeScript Definitions
Tiny Slider includes TypeScript type definitions out of the box:package.json
Import Methods
There are several ways to import and use Tiny Slider depending on your project setup:ES6 Module Import (Webpack/Rollup)
If you’re using a module bundler like Webpack or Rollup:Direct ES6 Module Import (v2.8.2+)
Modern browsers support ES6 modules natively:CommonJS Require
For Node.js or older bundler setups:Global Variable (CDN)
When using the CDN version,tns is available as a global variable:
Verification
To verify that Tiny Slider is installed correctly, you can check the version:Content Security Policy (CSP)
If your site uses Content Security Policy and disallowsunsafe-inline, you can use the nonce option:
The nonce value should match the nonce in your CSP header or meta tag.
Next Steps
Now that you have Tiny Slider installed, learn how to create your first slider:Quickstart Guide
Follow our step-by-step guide to create your first slider in minutes