-
-
Save harapeko/11437348 to your computer and use it in GitHub Desktop.
ヾ(o゚ω゚o)ノ゙Android4.1.2デフォルトブラウザのみ発生するdisabledバグ対応 ref: http://qiita.com/harapeko_wktk/items/b26d6f571d4cf88c04a6
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
#click_disabled_box{ | |
display: inline-block; | |
position: relative; | |
} | |
#click_disabled_area{ | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} |
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
<select id="month"> | |
<option value="noValue">--</option> | |
<option value="01">1</option> | |
<option value="02">2</option> | |
<option value="03">3</option> | |
</select> | |
<div id="click_disabled_box"> | |
<select id="day"> | |
<option value="noValue">--</option> | |
<option value="01">1</option> | |
<option value="02">2</option> | |
<option value="03">3</option> | |
</select> | |
</div> |
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
function click_disabled(){ | |
var month_box$ = $('#month'); //月 | |
var day_box$ = $('#day'); //日 | |
// クリックできない領域を差し込む為のラッパー | |
var click_disabled$ = $('#click_disabled_box'); | |
//ページが読み込まれた時、月と日が未選択ならdisabled | |
if(month_box$.val()==='noValue' && day_box$.val()==='noValue'){ | |
click_disabled_box$.append('<div id="click_disabled_area"> </div>'); | |
day_box$.css('opacity','0.5'); | |
} | |
month_box$.change(function(){ | |
//月未選択で、日未選択にしてdisabled処理 | |
if(month_box$.val()==='noValue'){ | |
day_box$.val('noValue'); | |
day_box$.prop('disabled', true); | |
//月選択時、日未選択なら日選択できるようにする | |
}else if(month_box$.val()!=='noValue' && day_box$.val()==='noValue'){ | |
$('#click_disabled_area').remove(); | |
day_box$.css('opacity','1.0'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment