HTML5:是否有"onrelease"广告素材?像输入类型范围的事件? [英] HTML5: is there an "onrelease" like event for input type range?

查看:72
本文介绍了HTML5:是否有"onrelease"广告素材?像输入类型范围的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

释放滑块后,我需要一个函数, "onchange"更改值,而即时更改. 有解决方案吗?

I need a function to be called when the slider has been released, "onchange" changes the value while im changing it. Is there a solution for this?

像这样

<input type="range" min="0" max="1000" onrelease="callfunction()">

推荐答案

使用mouseup 事件"rel =" noreferrer > touchend 手机上的事件,用于处理此用户交互.

Use the mouseup event on desktop browsers and the touchend event on mobile phones for handling this user interaction.

<input type="range" min="0" max="1" 
       onmouseup="callfunction()" 
       ontouchend="callfunction()">

我建议您检查 caniuse.com 以获取浏览器支持.

I would recommend to check caniuse.com for browser support.

已知问题(截至2019-03-25):

  • IE10 & 11 fire the "change" event instead of "input" on mousemove.
  • IE10 & 11 have some bugs related to the step value.

这篇关于HTML5:是否有"onrelease"广告素材?像输入类型范围的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆