遇到jquery和快速点击点燃火灾

时间:2013-04-18 10:00:21

标签: javascript jquery kindle-fire fastclick.js

我有一个网页,我打开一个jquery计算器。此页面仅适用于来自桌面的safari和来自Android设备的chrome,因为我使用的是嵌入式数据库。

当有人使用表格设备导航到该页面时,与计算器的交互非常慢,所以我使用了fastclick库,问题就解决了。有了这个库,我必须手动将一些jquery类添加到按钮元素,例如ui-state-hover,因为stopPropagation()和preventDefault()。

计算器速度快,悬停颜色非常适合点火。当我删除jquery类或尝试模糊按钮似乎不起作用。此外,我试图为这个按钮设置css规则,以便在我点击它们时它们不会聚焦。似乎没什么用。我看到这个库不支持该设备的丝网浏览器,但它修复了300ms的延迟。

有没有办法覆盖kindle fire jquery事件?问题在于丝网浏览器?

我的代码是:

document.getElementById("inv_calc_button_" + id).addEventListener('touchend', function(event) {
    event.stopPropagation();
    event.preventDefault();
    _function();
    $("#inv_calc .inv_calc_button").removeClass("ui-state-hover");
    $(this).addClass("ui-state-hover");
}, false);

if (!(/\bSilk\b/.test(navigator.userAgent))) {
    document.getElementById("inv_calc_button_" + id).addEventListener('click', function(event) { _function(); }, false);
}

这就是我如何覆盖按钮的css打开计算器并适用于除了点燃之外的所有计算器:

.item_table button.ui-state-hover, .item_table button.ui-state-focus, .item_table button.ui-state-highlight {
border: 1px solid #cccccc !important;
background: #f6f6f6 url(/webfile?name=css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x !important;
font-weight: bold !important;
color: #1c94c4 !important;
}

0 个答案:

没有答案