mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-05 13:14:45 +00:00
add disabled option support. fixes #350
This commit is contained in:
parent
e4f55d3c91
commit
e2eb9e9298
4 changed files with 22 additions and 10 deletions
|
|
@ -82,7 +82,7 @@ $.fn.buttonMarkup.defaults = {
|
|||
};
|
||||
|
||||
var attachEvents = function() {
|
||||
$(".ui-btn").live({
|
||||
$(".ui-btn:not(.ui-disabled)").live({
|
||||
mousedown: function() {
|
||||
var theme = $(this).attr( "data-theme" );
|
||||
$(this).removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme );
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
|
|||
});
|
||||
|
||||
//events for list items
|
||||
list.delegate("li",'click', function(){
|
||||
list.delegate("li:not(.ui-disabled)", "click", function(){
|
||||
//update select
|
||||
var newIndex = list.find( "li" ).index( this ),
|
||||
prevIndex = select[0].selectedIndex;
|
||||
|
|
@ -161,13 +161,22 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
|
|||
|
||||
//populate menu with options from select element
|
||||
self.select.find( "option" ).each(function( i ){
|
||||
var anchor = $("<a>", {
|
||||
"role": "option",
|
||||
"href": "#"
|
||||
})
|
||||
.text( $(this).text() );
|
||||
var anchor = $("<a>", {
|
||||
"role": "option",
|
||||
"href": "#",
|
||||
"text": $(this).text()
|
||||
}),
|
||||
|
||||
item = $( "<li>", {"data-icon": "checkbox-on"});
|
||||
|
||||
$( "<li>", {"data-icon": "checkbox-on"})
|
||||
// support disabled option tags
|
||||
if( this.disabled ){
|
||||
item
|
||||
.addClass("ui-disabled")
|
||||
.attr("aria-disabled", true);
|
||||
}
|
||||
|
||||
item
|
||||
.append( anchor )
|
||||
.appendTo( self.list );
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ a.ui-link-inherit { text-decoration: none !important; }
|
|||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-disabled { cursor: default !important; opacity: .3; }
|
||||
.ui-disabled { opacity: .3; }
|
||||
.ui-disabled, .ui-disabled a { cursor: default !important; }
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
|
|
|||
|
|
@ -701,9 +701,11 @@ a.ui-link-inherit {
|
|||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-disabled {
|
||||
cursor: default !important;
|
||||
opacity: .3;
|
||||
}
|
||||
.ui-disabled, .ui-disabled a {
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue