Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit e7a7c3d

Browse files
committed
Merge pull request #79 from andreruffert/handleEnd-issue-fix
handleEnd issue fix
2 parents 64a5dc9 + 3e87976 commit e7a7c3d

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

dist/rangeslider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! rangeslider.js - v0.3.1 | (c) 2014 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
2-
'use strict';
3-
42
(function(factory) {
3+
'use strict';
4+
55
if (typeof define === 'function' && define.amd) {
66
// AMD. Register as an anonymous module.
77
define(['jquery'], factory);
@@ -14,6 +14,7 @@
1414
factory(jQuery);
1515
}
1616
}(function($) {
17+
'use strict';
1718

1819
/**
1920
* Range feature detection
@@ -203,9 +204,8 @@
203204
this.$document.off(this.moveEvent, this.handleMove);
204205
this.$document.off(this.endEvent, this.handleEnd);
205206

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

dist/rangeslider.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,16 @@ <h2>Destroy a plugin instance</h2>
169169
onInit: function() {},
170170

171171
// Callback function
172-
onSlide: function(position, value) {},
172+
onSlide: function(position, value) {
173+
console.log('onSlide');
174+
console.log('position: ' + position, 'value: ' + value);
175+
},
173176

174177
// Callback function
175-
onSlideEnd: function(position) {}
178+
onSlideEnd: function(position, value) {
179+
console.log('onSlideEnd');
180+
console.log('position: ' + position, 'value: ' + value);
181+
}
176182
});
177183

178184
});

src/rangeslider.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
(function(factory) {
2+
'use strict';
3+
24
if (typeof define === 'function' && define.amd) {
35
// AMD. Register as an anonymous module.
46
define(['jquery'], factory);
@@ -201,9 +203,8 @@
201203
this.$document.off(this.moveEvent, this.handleMove);
202204
this.$document.off(this.endEvent, this.handleEnd);
203205

204-
var posX = this.getRelativePosition(this.$range[0], e);
205206
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
206-
this.onSlideEnd(posX - this.grabX, this.value);
207+
this.onSlideEnd(this.position, this.value);
207208
}
208209
};
209210

0 commit comments

Comments
 (0)