2
我有一張使用Floa Graph Lib繪製的圖表,x軸有30個點代表一個月中的天數。每天都有一個DIV和.tickLabel的類名,如果用戶點擊任何日期,對話框將顯示填入與日期相關的信息。以下是我的代碼。它適用於使用桌面瀏覽器進行測試但不在電話中進行測試。Jquery mobile點擊事件未被觸發
<!-- link button to show dialog. -->
<a data-role='actionsheet'
data-sheet='showtrackers'
id="as"
data-inline='true'></a>
<!-- dialog, this is pop up when user click on x-axis label point. -->
<div id="showtrackers">
<h3>Heading</h3><hr/>
Form goes here
<a data-role="button" data-theme="aa" data-inline="true" style="text-shadow:none">Save</a>
</div>
// .tickLabel is tha class name of each label of x-axis
$($(".tickLabel").click(function(){
var myText = $(this).text();
// change the all x-axis point label color to black
$(".tickLabel").each(function(){
$(this).css('color', '#000');
});
// highlight the clicked x-axis label point to orange
$(this).css('color', '#FAA016');
// according to clicked x-axis point, pop up shows
$("#as").click();
}));