按钮不registrering点击 [英] Button not registrering clicks

查看:194
本文介绍了按钮不registrering点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图用取自这些CSS3按钮: http://lab.simurai.com/按钮/

So I'm trying to use these CSS3 buttons taken from: http://lab.simurai.com/buttons/

下面是我创建的按钮: http://utvecklingspunkten.se/glist /admin/addGuests/button.php

Here is the button I've created: http://utvecklingspunkten.se/glist/admin/addGuests/button.php

正如标题所指出的按钮功能时,点击并不总是闪光。有一些斑点/它似乎没有注册点击像素(这是奇怪的,因为按钮仍然没有对这些甜蜜点点击时改变它的外观 - 但它不费一枪它的onClick功能)

As the title states the buttons function doesn't always fire when clicked on. There are some spots/pixels which doesn't seem to register the click (which is weird since the button still does change its appearance when clicked on these sweet spots - but it's not firing its onClick function).

因此​​,这里是code我用它来生成按钮:

So here is the code I use to generate the button:

<div style="margin-left:500px; margin-top:100px;">
    <a href='#' class='button gray glossy' data-icon='✎' onClick='clickHandler()' />
Try clicking this button</a>
</div>

和简单的JavaScript:

And the simple JavaScript:

var timesClicked = 0;

function clickHandler() {
    console.log("I've been clicked " + timesClicked + "times.");
    ++timesClicked;
}

这似乎不登记现货(而在该高​​度当场发现)位于按钮上的文字的基线以下几个像素。尝试与控制台了(在控制台中点击寄存器)刚刚点击下面的文字了几次,当你发现当场发现。甜蜜点并不难找到,使按钮pretty因为点击它的按钮将不会注册一定高度没用。

The spot (rather at which height the spot is found) which doesn't seem to register is located a few pixels below the baseline of the text in the button. Try clicking just below the text a few times with the console up (the click registers in the console) and notice when you find the spot. The sweet spot isn't that hard to find and makes the button pretty useless since clicking on it at a certain height of the button won't register.

有谁知道为什么吗?

推荐答案

我看到这个问题,当你拖动指针单击鼠标的地方,这样你就可以通过改变避免这种情况的的onclick 按事件 onmousedown事件事件。

I see the problem when you drag you pointer where the mouse is clicked, so you can avoid this by change the onclick event by onmousedown event.

这篇关于按钮不registrering点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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