禁用HTML5范围输入的跟踪 [英] Disable track on HTML5 range input

查看:127
本文介绍了禁用HTML5范围输入的跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图找到一种方法来阻止用户点击HTML5范围输入的轨道部分。基本上,我只希望用户能够使用句柄来更改范围值。

I'm trying to find a way to prevent the user from clicking into the "track" portion of an HTML5 range input. Essentially, I only want the user to be able to use the "handle" to change the range value.

这是否可能?

推荐答案

至少在chrome上可以通过指针事件。

It's possible through pointer-events at least on chrome.

input[type=range] {
pointer-events: none;
}

input[type=range]::-webkit-slider-thumb {
pointer-events:auto;
}

这将禁用单击轨道并仅启用滑块拇指点击。

This will disable clicking on the track and enable clicking only on slider thumbs.

这篇关于禁用HTML5范围输入的跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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