1
我跟踪一个计时器,我想以5秒为间隔触发。问题是 与我的Javascript math.round阈值
if (Math.round(time.position) % 5 === 0){do stuff}
测试触发太多次了。它会触发所有的9.〜十进制值。 如何以5秒为间隔触发?
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.29} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.43} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.54} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.68} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.79} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 9.92} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.03} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.18} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.29} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.42} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.54} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.68} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.79} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 10.92} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 11.04} index.html:104
time: Object {duration: 149.49, type: "jwplayerMediaTime", position: 11.17}
'setInterval(function(){...},5000);'是否足够? – Mandera 2014-09-23 22:14:51
不,这是由视频播放器定时器触发的。 – seasick 2014-09-23 22:15:05
你必须跟踪你已经覆盖的职位。 – Pointy 2014-09-23 22:15:21