增加一个按钮的点击区域 [英] increasing clickable area of a button
问题描述
不找任何实际code只是在这一个正确的方向的一个点。
not looking for any actual code just a point in the right direction with this one.
反正是有增加一个按钮的目标区域,但不会增加它的大小?比如我可以有效地增加一个5-10px区周围的按钮,将仍然算作点击按钮。
Is there anyway to increase the target area of a button but not increase it's size? for instance could i effectively add a 5-10px area around the button that will still count as clicking the button.
所有的我已经看到增加按钮,我不想这样做,因为这将推动其它元素格格不入的实际大小的方法。我唯一的想法等是有任何点击的监听器,可用于确定最接近的可点击的元素,如果它是在5-10px有它火。
All of the methods i have seen increase the actual size of button which i do not want to do as this would push other elements out of place. My only other thinking is to have a listener for any clicks that can determine the closest clickable element and if it's within 5-10px have it fire.
推荐答案
您可以添加一个伪元素(:在
/ :在
),但要注意两个环节附近可能会重叠这种方式。
You could add a pseudo-element (:after
/ :before
), but be careful as two nearby links might overlap this way ..
<a href="your-link-here" class="big-link">some link text</a>
和
a.big-link{position:relative;}
a.big-link:before{
position:absolute;
content:'';
top:-10px;
right:-10px;
left:-10px;
bottom:-10px;
}
演示在 http://jsfiddle.net/kq8pq/2/
这篇关于增加一个按钮的点击区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!