Fix for togglebox and menu_enabled_for

This commit is contained in:
chris committed 2013-10-30 17:26:31 +08:00
1 parent dfd0b5c1fb
commit 62c663d699
5 files changed
+53 -51

No files matched your search

+38 -36
View File
@@ -65,36 +65,38 @@ if($.support.touch) {
$checked.each(function(i) {
if($(this).attr('type') == "checkbox") {
if($(this).data().disabled) {
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
console.log("d")
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
if($(this).prop('checked')) {
$(this).parent('.togglebox').removeClass('disabled').closest('li').removeClass('disabled');
$(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
};
} else {
console.log($(this))
if($(this).prop('checked')) {
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
};
}
$(this).on({
change: function() {
$(this).parent('.togglebox').toggleClass('disabled');
$(this).parent('.togglebox').toggleClass('disable');
$(this).closest('tr').toggleClass('disable');
}
});
};
if($(this).attr('type') == "radio") {
if(!$(this).prop('checked')) {
$(this).parent('.togglebox').addClass('disabled').closest('li').addClass('disabled');
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
$(this).closest('tr').addClass('disable');
};
$(this).on({
change: function() {
$checked.not($(".toggle-check[type='checkbox']")).each(function(i) {
if(!$(this).parent('.togglebox').hasClass('disabled')) {
$(this).parent('.togglebox').toggleClass('disabled');
if(!$(this).parent('.togglebox').hasClass('disable')) {
$(this).parent('.togglebox').toggleClass('disable');
$(this).closest('tr').toggleClass('disable');
};
});
$(this).parent('.togglebox').toggleClass('disabled')
$(this).parent('.togglebox').toggleClass('disable')
$(this).closest('tr').toggleClass('disable');
}
});
@@ -110,7 +112,7 @@ if($.support.touch) {
.find('li')
.addClass('disabled')
.find('h6 .togglebox')
.addClass('disabled')
.addClass('disable')
.find('input[type="checkbox"]')
.prop('checked', true)
.attr('checked', 'checked');
@@ -121,37 +123,37 @@ if($.support.touch) {
.find('li')
.removeClass('disabled')
.find('h6 .togglebox')
.removeClass('disabled')
.removeClass('disable')
.find('input[type="checkbox"]')
.prop('checked', false)
.removeAttr('checked');
};
$('.toggle-check').each(function(i) {
var len = $(this).closest('ul').children('li').length,
checLen = $(this).closest('ul').children('li').find('input[checked]').length,
checLen = checLen - $(this).closest('ul').children('li').find('ul').find('input[checked]').length;
if(len == checLen) {
$(this).closest('ul')
.parent('li')
.addClass('disabled')
.children('h6')
.find('.togglebox')
.addClass('disabled')
.find('input[type="checkbox"]')
.prop('checked', true)
.attr('checked', 'checked');
} else {
$(this).closest('ul')
.parent('li')
.removeClass('disabled')
.children('h6')
.find('.togglebox')
.removeClass('disabled')
.find('input[type="checkbox"]')
.prop('checked', false)
.removeAttr('checked');
};
});
// $('.toggle-check').each(function(i) {
// var len = $(this).closest('ul').children('li').length,
// checLen = $(this).closest('ul').children('li').find('input[checked]').length,
// checLen = checLen - $(this).closest('ul').children('li').find('ul').find('input[checked]').length;
// if(len == checLen) {
// $(this).closest('ul')
// .parent('li')
// .addClass('disabled')
// .children('h6')
// .find('.togglebox')
// .addClass('disable')
// .find('input[type="checkbox"]')
// .prop('checked', true)
// .attr('checked', 'checked');
// } else {
// $(this).closest('ul')
// .parent('li')
// .removeClass('disabled')
// .children('h6')
// .find('.togglebox')
// .removeClass('disable')
// .find('input[type="checkbox"]')
// .prop('checked', false)
// .removeAttr('checked');
// };
// });
},
});
};