【发布时间】:2019-03-12 01:03:15
【问题描述】:
我注意到以下代码在台式机和笔记本电脑上运行良好,但不能在我的 Android 手机或其他移动设备上运行,以在用户单击滑块时更改歌曲的持续时间:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="timeline-box">
<input id="seekslider" type="range" min="0" max="100" value="0" step="1"><br>
</div>
**//jQuery to detect when user changes the timeline with the seekslider
$(document).ready(function(){
$("#seekslider").mouseup(function(e){
var leftOffset = e.pageX - $(this).offset().left;
var songPercents = leftOffset / $('#seekslider').width();
audio.currentTime = songPercents * audio.duration;
});
});**
如果有人可以帮助我解决在 jQuery 或 Javascript 中单击滑块时更改持续时间的问题,我将不胜感激。
【问题讨论】:
标签: javascript jquery audio time duration