mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-21 04:41:52 +00:00
added support for enable and disable methods
This commit is contained in:
parent
336dc36297
commit
2e86ed1425
1 changed files with 21 additions and 1 deletions
|
|
@ -33,9 +33,15 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
|
|||
.wrapAll( "<div class='ui-" + inputtype +"'></div>" );
|
||||
|
||||
label.bind({
|
||||
mouseover: function() {
|
||||
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: function() {
|
||||
setTimeout(function() {
|
||||
if ( input.attr( "checked" ) === label.data( "state" ) ) {
|
||||
|
|
@ -45,7 +51,6 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
|
|||
}
|
||||
});
|
||||
|
||||
//bind custom event, trigger it, bind click,focus,blur events
|
||||
input
|
||||
.bind({
|
||||
|
||||
|
|
@ -84,6 +89,21 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
|
|||
icon.removeClass( checkedicon );
|
||||
icon.addClass( uncheckedicon );
|
||||
}
|
||||
|
||||
if( input.is( ":disabled" ) ){
|
||||
this.disable();
|
||||
}
|
||||
else {
|
||||
this.enable();
|
||||
}
|
||||
},
|
||||
|
||||
disable: function(){
|
||||
this.element.attr("disabled",true).parent().addClass("ui-disabled");
|
||||
},
|
||||
|
||||
enable: function(){
|
||||
this.element.attr("disabled",false).parent().removeClass("ui-disabled");
|
||||
}
|
||||
});
|
||||
})( jQuery );
|
||||
|
|
|
|||
Loading…
Reference in a new issue