This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved check/uncheck event on label to touchend/mouseup. Fixes #753
- Loading branch information
scottjehl
committed
Jan 21, 2011
1 parent
a1cb31a
commit 38c1c24
Showing
1 changed file
with
8 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { | |
theme: null | ||
}, | ||
_create: function(){ | ||
var input = this.element, | ||
var self = this, | ||
input = this.element, | ||
label = input.closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), | ||
inputtype = input.attr( "type" ), | ||
checkedicon = "ui-icon-" + inputtype + "-on", | ||
|
@@ -40,18 +41,13 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { | |
if( $(this).parent().is('.ui-disabled') ){ return false; } | ||
}, | ||
|
||
mousedown: function() { | ||
if( $(this).parent().is('.ui-disabled') ){ return false; } | ||
label.data( "state", input.attr( "checked" ) ); | ||
}, | ||
click: false | ||
|
||
click: function() { | ||
setTimeout(function() { | ||
if ( input.attr( "checked" ) === label.data( "state" ) ) { | ||
input.trigger( "click" ); | ||
} | ||
}, 1); | ||
} | ||
}) | ||
.bind( $.support.touch ? "touchend" : "mouseup", function(){ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
scottjehl
|
||
if( $(this).parent().is('.ui-disabled') ){ return false; } | ||
input.attr( "checked", !input.is( ":checked" ) ); | ||
self.refresh(); | ||
}); | ||
|
||
input | ||
|
2 questions
1.the radio set not refresh correctly
2.how to bind the custom listener to the controller? as you won't fire any input's event in the touchend, mouseup listenter