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 #79 from andreruffert/handleEnd-issue-fix
Browse files Browse the repository at this point in the history
handleEnd issue fix
  • Loading branch information
andreruffert committed Aug 4, 2014
2 parents 64a5dc9 + 3e87976 commit e7a7c3d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/rangeslider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*! rangeslider.js - v0.3.1 | (c) 2014 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
'use strict';

(function(factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
Expand All @@ -14,6 +14,7 @@
factory(jQuery);
}
}(function($) {
'use strict';

/**
* Range feature detection
Expand Down Expand Up @@ -203,9 +204,8 @@
this.$document.off(this.moveEvent, this.handleMove);
this.$document.off(this.endEvent, this.handleEnd);

var posX = this.getRelativePosition(this.$range[0], e);
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
this.onSlideEnd(posX - this.grabX, this.value);
this.onSlideEnd(this.position, this.value);
}
};

Expand Down
2 changes: 1 addition & 1 deletion dist/rangeslider.min.js

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

10 changes: 8 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,16 @@ <h2>Destroy a plugin instance</h2>
onInit: function() {},

// Callback function
onSlide: function(position, value) {},
onSlide: function(position, value) {
console.log('onSlide');
console.log('position: ' + position, 'value: ' + value);
},

// Callback function
onSlideEnd: function(position) {}
onSlideEnd: function(position, value) {
console.log('onSlideEnd');
console.log('position: ' + position, 'value: ' + value);
}
});

});
Expand Down
5 changes: 3 additions & 2 deletions src/rangeslider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(function(factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
Expand Down Expand Up @@ -201,9 +203,8 @@
this.$document.off(this.moveEvent, this.handleMove);
this.$document.off(this.endEvent, this.handleEnd);

var posX = this.getRelativePosition(this.$range[0], e);
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
this.onSlideEnd(posX - this.grabX, this.value);
this.onSlideEnd(this.position, this.value);
}
};

Expand Down

0 comments on commit e7a7c3d

Please sign in to comment.