Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery-asRange

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-asRange

A jquery plugin for convent input into range slider.

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-30.3%
Maintainers
1
Weekly downloads
 
Created
Source

jQuery asRange bower NPM version Dependency Status prs-welcome

A jquery plugin for convent input into range slider.

Table of contents

Main files

dist/
├── jquery-asRange.js
├── jquery-asRange.es.js
├── jquery-asRange.min.js
└── css/
    ├── asRange.css
    └── asRange.min.css

Quick start

Several quick start options are available:

Download the latest build
Install From Bower
bower install jquery-asRange --save
Install From Npm
npm install jquery-asRange --save
Install From Yarn
yarn add jquery-asRange
Build From Source

If you want build from source:

git clone git@github.com:amazingSurge/jquery-asRange.git
cd jquery-asRange
npm install
npm install -g gulp-cli babel-cli
gulp build

Done!

Requirements

jquery-asRange requires the latest version of jQuery.

Usage

Including files:
<link rel="stylesheet" href="/path/to/asRange.css">
<script src="/path/to/jquery.js"></script>
<script src="/path/to/jquery-asRange.js"></script>
Required HTML structure
<input class="example" type="range" min="0" max="10" name="points" step="0.01" />
Initialization

All you need to do is call the plugin on the element:

jQuery(function($) {
  $('.example').asRange(); 
});

Examples

There are some example usages that you can look at to get started. They can be found in the examples folder.

Options

jquery-asRange can accept an options object to alter the way it behaves. You can see the default options by call $.asRange.setDefaults(). The structure of an options object is as follows:

{
  namespace: 'asRange',
  skin: null,
  max: 100,
  min: 0,
  value: null,
  step: 10,
  limit: true,
  range: false,
  direction: 'h', // 'v' or 'h'
  keyboard: true,
  replaceFirst: false, // false, 'inherit', {'inherit': 'default'}
  tip: true,
  scale: true,
  format(value) {
    return value;
  }
}
PropertyDefaultDescription
namespace"range"Optional property, set a namspace for css class, for example, we have .range_active class for active effect, if namespace set to 'as-range', then it will be .as-range_active
skinnullCompulsory property, set transition effect, it works after you load specified skin file
max100Optional property, set the maximum range value of the progress bar
min0Optional property, set the initial value of the progress bar
value[0,20]Optional property, set the pointer to the initial position
step10Optional property, set up the moving step at a time
pointer2Optional property, set the number of pointer
limittrueOptional property, if true, limit the range of the pointer moving
orientation'v'Optional property, set the direction for the progress bar ,'v' for vertical and 'h' for horizontal
tiptrueOptional property, if true, the component of tip will display and follow the pointer
scaleObjectOptional property, values means the value you want to add to scale; gap means how many parts you want to division between value; grid means how many small parts in the part
formatfunction(value) {return value;}Optional property, a function of formatting output
onChangefunction(instance) {}Optional property, according to your need, it can be as a function of the extended interface
callbackfunction() {}Optional property, if it's a funciton, will be called when mouseup

Methods

Methods are called on asRange instances through the asRange method itself. You can also save the instances to variable for further use.

// call directly
$().asRange('destroy');

// or
var api = $().data('asRange');
api.destroy();
val(value)

Set the range if value is defined or get the value.

// set the val
$().asRange('val', '5');

// get the val
var value = $().asRange('val');
set(value)

Set the range value

$().asRange('set', '5');
get()

Get the range value.

var value = $().asRange('get');
enable()

Enable the range functions.

$().asRange('enable');
disable()

Disable the range functions.

$().asRange('disable');
destroy()

Destroy the range instance.

$().asRange('destroy');

Events

jquery-asRange provides custom events for the plugin’s unique actions.

$('.the-element').on('asRange::ready', function (e) {
  // on instance ready
});

EventDescription
initFires when the instance is setup for the first time.
readyFires when the instance is ready for API use.
enableFires immediately when the enable instance method has been called.
disableFires immediately when the disable instance method has been called.
changeFires when the position of pointer is changed
endFires when mouse up
destroyFires when an instance is destroyed.

No conflict

If you have to use other plugin with the same namespace, just call the $.asRange.noConflict method to revert to it.

<script src="other-plugin.js"></script>
<script src="jquery-asRange.js"></script>
<script>
  $.asRange.noConflict();
  // Code that uses other plugin's "$().asRange" can follow here.
</script>

Browser support

Tested on all major browsers.

SafariChromeFirefoxEdgeIEOpera
Latest ✓Latest ✓Latest ✓Latest ✓9-11 ✓Latest ✓

As a jQuery plugin, you also need to see the jQuery Browser Support.

Contributing

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing. Make sure you're using the latest version of jquery-asRange before submitting an issue. There are several ways to help out:

Development

jquery-asRange is built modularly and uses Gulp as a build system to build its distributable files. To install the necessary dependencies for the build system, please run:

npm install -g gulp
npm install -g babel-cli
npm install

Then you can generate new distributable files from the sources, using:

gulp build

More gulp tasks can be found here.

Changelog

To see the list of recent changes, see Releases section.

Copyright (C) 2016 amazingSurge.

Licensed under the LGPL license.

⬆ back to top

Keywords

FAQs

Package last updated on 28 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc