JSFiddle - React, Tailwind, and code Playground
JavaScript
/**
* jquery.slider - Slider ui control in jQuery
*
* Written by
* Egor Khmelev (hmelyoff@gmail.com)
*
* Licensed under the MIT (MIT-LICENSE.txt).
*
* @author Egor Khmelev
* @version 1.1.0-RELEASE ($Id$)
*
* Dependencies
*
* jQuery (http://jquery.com)
* jquery.numberformatter (http://code.google.com/p/jquery-numberformatter/)
* tmpl (http://ejohn.org/blog/javascript-micro-templating/)
* jquery.dependClass
* draggable
*
**/
(function( $ ) {
function isArray( value ){
if( typeof value == "undefined" ) return false;
if (value instanceof Array || (!(value instanceof Object) &&
(Object.prototype.toString.call((value)) == '[object Array]') ||
typeof value.length == 'number' &&
typeof value.splice != 'undefined' &&
typeof value.propertyIsEnumerable != 'undefined' &&
!value.propertyIsEnumerable('splice')
)) {
return true;
}
return false;
}
$.slider = function( node, settings ){
var jNode = $(node);
if( !jNode.data( "jslider" ) )
jNode.data( "jslider", new jSlider( node, settings ) );
return jNode.data( "jslider" );
};
$.fn.slider = function( action, opt_value ){
var returnValue, args = arguments;
function isDef( val ){
return val !== undefined;
};
function isDefAndNotNull( val ){
return val != null;
};
this.each(function(){
var self = $.slider( this, action );
// do actions
if( typeof action == "string" ){
switch( action ){
case "value":
if( isDef( args[ 1 ] ) && isDef( args[ 2 ] ) ){
var pointers = self.getPointers();
if( isDefAndNotNull( pointers[0] ) && isDefAndNotNull( args[1] ) ){
pointers[0].set( args[ 1 ] );
pointers[0].setIndexOver();
}
if( isDefAndNotNull( pointers[1] ) && isDefAndNotNull( args[2] ) ){
pointers[1].set( args[ 2 ] );
...