2
我遇到了使用jQuery訪問事件的事件座標的問題。我的代碼如下。每當我更改音量滑塊時,它將返回undefined而不是光標位置。jQuery e.clientX返回undefined
$(document).ready(function(){
// for new browsers
$("input#volume").bind('input', function(e){
if (is_playing()) {
now_playing.volume = parseFloat((this.value/100));
// set the tooltp for the current volume
var vol_tooltip = Math.floor((this.value/100)*100);
// $(".seek_timer").remove();
console.log(e.clientX);
// $(".slider-wrap").append("<span class='seek_timer'>"+vol_tooltip+"</span>");
// $(".seek_timer").css("left",e.clientX-15+"px");
}
});
});
爲什麼e.clientX
未定義?
據我所知輸入不是鼠標事件,因此它沒有鼠標位置。 –