Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #128 from andreruffert/release-1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
andreruffert committed Feb 11, 2015
2 parents 6a467de + 6652add commit 478d5ba
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#rangeslider.js
# rangeslider.js
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![rangeslider.js](http://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://andreruffert.github.io/rangeslider.js/) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js)

>Simple, small and fast JavaScript/jQuery polyfill for the HTML5 `<input type="range">` slider element.
> Simple, small and fast JavaScript/jQuery polyfill for the HTML5 `<input type="range">` slider element.
Check out the [examples](http://andreruffert.github.io/rangeslider.js/).

Expand All @@ -10,14 +10,14 @@ Check out the [examples](http://andreruffert.github.io/rangeslider.js/).
* Small and fast
* Supports all major browsers including IE8+

##Install
## Install
Install with [Bower](http://bower.io/):
``bower install --save rangeslider.js``

Install with [npm](https://www.npmjs.org/):
``npm install --save rangeslider.js``

##Usage
## Usage

```
// Initialize a new plugin instance for all
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rangeslider.js",
"version": "0.3.9",
"version": "1.0.0",
"homepage": "https://github.com/andreruffert/rangeslider.js",
"authors": [
"André Ruffert <[email protected]>"
Expand Down
18 changes: 13 additions & 5 deletions dist/rangeslider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! rangeslider.js - v0.3.9 | (c) 2015 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
/*! rangeslider.js - v1.0.0 | (c) 2015 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
(function(factory) {
'use strict';

Expand Down Expand Up @@ -207,15 +207,15 @@

// Attach Events
var _this = this;
this.$window.on('resize' + '.' + this.identifier, debounce(function() {
this.$window.on('resize.' + this.identifier, debounce(function() {
// Simulate resizeEnd event.
delay(function() { _this.update(); }, 300);
}, 20));

this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);

// Listen to programmatic value changes
this.$element.on('change' + '.' + this.identifier, function(e, data) {
this.$element.on('change.' + this.identifier, function(e, data) {
if (data && data.origin === _this.identifier) {
return;
}
Expand Down Expand Up @@ -282,6 +282,9 @@
this.$document.off(this.moveEvent, this.handleMove);
this.$document.off(this.endEvent, this.handleEnd);

// Ok we're done fire the change event
this.$element.trigger('change', { origin: this.identifier });

if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
this.onSlideEnd(this.position, this.value);
}
Expand Down Expand Up @@ -360,9 +363,14 @@
};

Plugin.prototype.setValue = function(value) {
if (value !== this.value) {
this.$element.val(value).trigger('change', {origin: this.identifier});
if (value === this.value) {
return;
}

// Set the new value and fire the `input` event
this.$element
.val(value)
.trigger('input', { origin: this.identifier });
};

Plugin.prototype.destroy = function() {
Expand Down
4 changes: 2 additions & 2 deletions dist/rangeslider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h2>Combination with native <code>&lt;details&gt;</code> element</h2>
for (var i = $element.length - 1; i >= 0; i--) {
valueOutput($element[i]);
};
$document.on('change', 'input[type="range"]', function(e) {
$document.on('input', 'input[type="range"]', function(e) {
valueOutput(e.target);
});

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "rangeslider.js",
"title": "rangeslider.js",
"description": "Simple, small and fast JavaScript/jQuery polyfill for the HTML5 <input type=\"range\"> slider element",
"version": "0.3.9",
"codename": "Periwinkle",
"version": "1.0.0",
"codename": "Peach",
"main": "dist/rangeslider.js",
"homepage": "https://github.com/andreruffert/rangeslider.js",
"author": {
Expand Down Expand Up @@ -51,4 +51,4 @@
"scripts": {
"test": "grunt jshint"
}
}
}
16 changes: 12 additions & 4 deletions src/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@

// Attach Events
var _this = this;
this.$window.on('resize' + '.' + this.identifier, debounce(function() {
this.$window.on('resize.' + this.identifier, debounce(function() {
// Simulate resizeEnd event.
delay(function() { _this.update(); }, 300);
}, 20));

this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);

// Listen to programmatic value changes
this.$element.on('change' + '.' + this.identifier, function(e, data) {
this.$element.on('change.' + this.identifier, function(e, data) {
if (data && data.origin === _this.identifier) {
return;
}
Expand Down Expand Up @@ -281,6 +281,9 @@
this.$document.off(this.moveEvent, this.handleMove);
this.$document.off(this.endEvent, this.handleEnd);

// Ok we're done fire the change event
this.$element.trigger('change', { origin: this.identifier });

if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
this.onSlideEnd(this.position, this.value);
}
Expand Down Expand Up @@ -359,9 +362,14 @@
};

Plugin.prototype.setValue = function(value) {
if (value !== this.value) {
this.$element.val(value).trigger('change', {origin: this.identifier});
if (value === this.value) {
return;
}

// Set the new value and fire the `input` event
this.$element
.val(value)
.trigger('input', { origin: this.identifier });
};

Plugin.prototype.destroy = function() {
Expand Down

0 comments on commit 478d5ba

Please sign in to comment.