|
5 | 5 | //>>css.structure: ../css/structure/jquery.mobile.forms.slider.css
|
6 | 6 | //>>css.theme: ../css/themes/default/jquery.mobile.theme.css
|
7 | 7 |
|
8 |
| -define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "./textinput", "../../jquery.mobile.buttonMarkup" ], function( $ ) { |
| 8 | +define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "./textinput", "../../jquery.mobile.buttonMarkup", "./reset" ], function( $ ) { |
9 | 9 | //>>excludeEnd("jqmBuildExclude");
|
10 | 10 | (function( $, undefined ) {
|
11 | 11 |
|
12 | 12 | $.widget( "mobile.slider", $.mobile.widget, {
|
13 |
| - widgetEventPrefix: "slide", |
14 |
| - |
15 | 13 | options: {
|
16 | 14 | theme: null,
|
17 | 15 | trackTheme: null,
|
@@ -178,6 +176,10 @@ $.widget( "mobile.slider", $.mobile.widget, {
|
178 | 176 |
|
179 | 177 | this.handle.bind( "vclick", false );
|
180 | 178 |
|
| 179 | + if ( this._handleFormReset ) { |
| 180 | + this._handleFormReset(); |
| 181 | + } |
| 182 | + |
181 | 183 | this.refresh( undefined, undefined, true );
|
182 | 184 | },
|
183 | 185 |
|
@@ -341,6 +343,11 @@ $.widget( "mobile.slider", $.mobile.widget, {
|
341 | 343 | return this.isToggleSwitch ? this.element[0].selectedIndex : parseFloat( this.element.val() ) ;
|
342 | 344 | },
|
343 | 345 |
|
| 346 | + |
| 347 | + _reset: function() { |
| 348 | + this.refresh( undefined, false, true ); |
| 349 | + }, |
| 350 | + |
344 | 351 | refresh: function( val, isfromControl, preventInputUpdate ) {
|
345 | 352 |
|
346 | 353 | // NOTE: we don't return here because we want to support programmatic
|
@@ -468,6 +475,13 @@ $.widget( "mobile.slider", $.mobile.widget, {
|
468 | 475 |
|
469 | 476 | });
|
470 | 477 |
|
| 478 | +$.widget( "mobile.slider", $.mobile.slider, $.mobile.behaviors.formReset ); |
| 479 | + |
| 480 | +// FIXME: Move the declaration of widgetEventPrefix back to the top of the |
| 481 | +// initial declaration of the slider widget once we start using a version of |
| 482 | +// the widget factory that includes a fix for http://bugs.jqueryui.com/ticket/8724 |
| 483 | +$.widget( "mobile.slider", $.mobile.slider, { widgetEventPrefix: "slide" } ); |
| 484 | + |
471 | 485 | //auto self-init widgets
|
472 | 486 | $( document ).bind( "pagecreate create", function( e ) {
|
473 | 487 | $.mobile.slider.prototype.enhanceWithin( e.target, true );
|
|
0 commit comments