SkillAgentSearch skills...

ISlider

Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App

Install / Use

/learn @be-fe/ISlider
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

iSlider

iSlider is a lightweight, high-performant, no library dependencies cross-platform slide controller. It can help handling most sliding effects, offering dozens of transition animations, and presenting various scenarios.

iSlider English README

iSlider DEMO

iSlider 中文文档

iSlider 演示

iSlider animation

Features

  • Outstanding performance, less memory usage;
  • Various animation effects, including effects such as default, rotate, depth, flow, flip, card, fade, etc., and capability of adding custom animations;
  • Provide rich callback trigger. Adding a callback function is easy, regardless of initialization or during operation;
  • Easy to configure, e.g. Slide the dampening effect of the cycle, automatic sliding effect, horizontal / vertical sliding, etc.
  • Automatic matching the desktop mouse movements or gestures on mobile device. Easy to test and use cross platforms;
  • Supports for image pre-loaded, excellent user experience;
  • [Plugin] Offers a variety of plug-ins, such as a toggle button, the scene indicator, image scaling, etc. Provides plug-in registration, management and other methods to facilitate custom extension;
  • [2.0+] Can be loaded on demand (effect or plug-in);
  • [2.0+] Supports more types of elements. Automatically matches the data type. Capable of image recognition and pre-loading;
  • [2.0+] Better delegated event management mechanism, optimized memory usage;
  • [2.0+] Enriched callback events, more flexible event management and trigger mechanisms;

Mobile demo

Demo http://be-fe.github.io/iSlider/index.html

Get iSlider

Clone from Github

git clone https://github.com/be-fe/iSlider.git

Use bower installation

bower install iSlider

Use npm installation

npm install islider.js

Started iSlider

The easiest way of getting started is to consult our examples, please visit the DEMOs.

Creating a container

<div id="iSlider-wrapper"></div>

Preparing some data

var data = [
    {content: "imgs/1.jpg"},
    {content: "imgs/2.jpg"},
    {content: "imgs/3.jpg"}
];

Loading iSlider

<script src="iSlider.min.js"></script>

Initializing a iSlider

var islider = new iSlider(document.getElementById('iSlider-wrapper'), data);

Or,

var islider = new iSlider({
    dom : document.getElementById('iSlider-wrapper'),
    data : data
});
var islider = new iSlider(document.getElementById('iSlider-wrapper'), data, {
    dom : document.getElementById('iSlider-wrapper'),
    data : data
});

Extending iSlider

Animations

If you want more effects, you can load the animation effect extensions, set up the configuration when initializing iSlider and specify animationType.

<script src="iSlider.min.js"></script>
<script src="iSlider.animate.min.js"></script>
var islider = new iSlider({
    dom: document.getElementById("iSlider-wrapper"),
    data: list,
    isVertical: true,
    isLooping: false,
    isDebug: true,
    isAutoplay: false,
    animateType: 'rotate'
});

Extension

From 2.x, iSlider supports extension registration. You can now extend iSlide with your own features.

<script src="iSlider.min.js"></script>
<script src="iSlider.plugin.dot.min.js"></script>
var islider = new iSlider({
    dom: document.getElementById("iSlider-wrapper"),
    data: list,
    plugins: ['dot'],
});

You can also pass in more custom params to the extension initialize method.

var islider = new iSlider({
    dom: document.getElementById("iSlider-wrapper"),
    data: list,
    plugins: [['dot', {background:'rgba(0,0,0,0)'}]],
});

That's it!

【Notice】: if you use npm to install iSlider, it will not contain plugin default, you can involve plugin like this:

var iSlider = require('islider.js');
require('../node_modules/islider.js/build/iSlider.plugin.button'); //引入button插件

Official Plugins

Button

Scene toggle button. For switching to the previous (left/up) or next (right/down) scene of the current scene.

Dot

Scene indicator, the current location and switch to a scene function

Zoompic

Mobile image scaling, image in non-background mode by double-clicking on the image or two fingers to enlarge, to amplify the effect of the preview.

  • Known issues: must restore the default size by double-clicking, double that currently can not be reduced to its default state
BIZone

Touch points from the edge of the area to identify, although has joined edge processing mouseout and touchcancel, but for some applications, the definition from the top (bottom) menu bar remains powerless. Meaning that it can take the initiative to identify areas of these regions is set to touch on detachment.

Scene data

From 2.x, iSlider no longer requires type to specify the data type. It can now detect wisely, so that you can easily use various types of data, e.g. images, HTML elements, fragments or selectors.

var data = [{
    'content' : './qrcode.png'  // picture
},{
    'content' : '<div><h1>Page1</h1><h2>This is page1</h2><p>page1 is pretty awsome</p><div>' // HTML
},{
    'content' : (function () { // element
            var dom = document.createElement('div');
            dom.innerHTML = 'Element';
            return dom;
        })()
},{
    'content' : (function () { // fragment
            var frag = document.createDocumentFragment();
            var dom = document.createElement('div');
            dom.innerHTML = 'Fragment';
            frag.appendChild(dom);
            return frag;
        })()
}{
      'content' : document.getElementById('node') // selectors
}];

To learn more advanced features, please refer to WIKI

iSlider details

Configurations

DOM (Optional, OPTIONS.dom)

  • new iSlider(DOM, DATA, OPTIONS);
  • {HTMLElement}
  • DOM Container
  • Though the first parameter is not required, it is highly recommended, as setting a DOM container can make it more convenient to use iSlider.

DATA (Optional, default: OPTIONS.data)

  • new iSlider(DOM, DATA, OPTIONS);
  • {Array}
  • Data list
  • Though it's not required, the second param is also recommended.
  • Allowed types: URLString, HTMLString, HTMLElement, HTMLFragment.
  • TODO: Currently, each of the member in the array is type of {Object}, which only supports content property, in the future, it will get more extensions, such as the configuration of the effect about each scene transitions, wait time, etc.
  • Data format:
[
    {
        content:'{URLString|HTMLString|HTMLElement|HTMLFragment}',
    },
    ...
]

OPTIONS

  • new iSlider(DOM, DATA, OPTIONS);
  • {Object}
dom
  • {HTMLElement}
  • dom node which is used as Container, same as the role of the parameter [DOM] (#dom), if this has been setted, DOM will be overwritten.
data
  • {Array}
  • A list of data, same as the role of the parameter [DATA] (#data), if this has been setted, DATA will be overwritten.
animateType
  • {String}
  • Animation
  • Currently supports: default (scrolling), rotate (rotation), depth, flow, flip, card, fade (fade in / hidden), (outside / inside zoom) zoomout
  • Precondition: Loading library iSlider.animate(.min).js which is used for effects
  • Default: "default"
animateTime
  • {Number}
  • Animation duration
  • Unit: ms
  • Default: 1000
animateEasing
  • {String}
  • Animation curve
  • Options: linear, ease, ease-in, ease-out, ease-in-out, even cubic-bezier
  • Default: ease
isAutoplay
  • {Boolean}
  • Turn on / off the automatic sliding mode
  • Default: false (Disabled)
duration
  • {Number}
  • Suspending time of scene when it's playback automatically
  • Suspending time of each scene, it switches to the next scene when it is ended
  • Unit: ms
  • Precondition: isAutoplay === TRUE
wakeupAutoplayDazetime
  • {Number}
  • User click/tap behavior(eg: active a link), or if the page loses focus will stop autoplay.
  • This configuration will attempt to restart autoplay after N milliseconds.
  • AutoPlay will be forced to wake up, even when the user fill in a form items !
  • It will be blocked by "lock()"
  • Unit: ms
  • Precondition: isAutoplay === TRUE
isLooping
  • {Boolean}
  • Repeat Mode
  • Default: false (Disabled)
dampingForce
  • {Number}
  • Damping force, the rebound effect of overflow Scene
  • Range: 0 ~ 1, Sliding distance decreases with increasing values (more difficult to slide)
  • Default: 0
  • Precondition: isLooping === FALSE
<a href="http://be-fe.github.io/static/images/iSlider-notice/dampingForce-origin.png"> <img src="http://be-fe.github.io/static/images/iSlider-notice/dampingForce-thumb.png"/> </a>
isVertical
  • {Boolean}
  • Vertical sliding mode
  • Default: false (Disabled)
isOverspread
  • {Boolean}
  • Background Tile
  • If the scene is picture mode (URL), use the CSS3 backgrounds ways to filling the scenes
  • Default: false (Disabled)
isTouchable
  • {Boolean}
  • Touch events
  • Default: true (Enabled)
isDebug
  • {Boolean}
  • On / off debug mode, it will print more information about the log
  • Default: false (Disabled)
initIndex
  • {Number}
  • Index of the list which is used for

Related Skills

View on GitHub
GitHub Stars1.6k
CategoryDevelopment
Updated1d ago
Forks445

Languages

JavaScript

Security Score

95/100

Audited on Mar 28, 2026

No findings