ラジオ ボタンをクリックすると変更を実行できますが、問題は、ページをリロードするとラジオ ボタンの選択は保持されますが、変更は保持されないことです。つまり、ラジオ ボタン #1 をクリックすると、特定のフィールドの不透明度が下がります。このページに戻ると、すべてのフィールドが完全に不透明になり、ラジオ ボタンをもう一度クリックするまでチャンスが実行されません。
これが私のコードです:
(function($) {
// Document Ready
$(document).ready(function() {
// trigger change on the radio list to show selected field
$('#acf-feature_slide ul.radio_list li label input').trigger('change');
});
// Content Type change
$('#acf-feature_slide ul.radio_list li label input').live('change', function() {
// vars
var value = $(this).val();
// show the selected field
if( value == "internal" ) {
$(this).parentsUntil('tr').find('div.row-layout-field').eq(3).css('opacity', '1.0');
$(this).parentsUntil('tr').find('div.row-layout-field').eq(4).css('opacity', '0.2');
}
else if( value == "external" ) {
$(this).parentsUntil('tr').find('div.row-layout-field').eq(3).css('opacity', '0.2');
$(this).parentsUntil('tr').find('div.row-layout-field').eq(4).css('opacity', '1.0');
}
else if( value == "none" ) {
$(this).parentsUntil('tr').find('div.row-layout-field').eq(3).css('opacity', '0.2');
$(this).parentsUntil('tr').find('div.row-layout-field').eq(4).css('opacity', '0.2');
}
else {
$(this).parentsUntil('tr').find('div.row-layout-field').eq(3).css('opacity', '1.0');
$(this).parentsUntil('tr').find('div.row-layout-field').eq(4).css('opacity', '1.0');
}
});
})(jQuery);
どんな助けでも大歓迎です。
ありがとう、