【发布时间】:2013-05-28 02:01:48
【问题描述】:
当用户在手机上触摸/点击时,我正在尝试更改链接的背景颜色,尽管以下代码有效,但有时链接仍然是黑色,并且在您释放时不会变回白色,是否存在更好的编码方式?
$('#test').bind('touchstart', function() {
$(this).css('background-color', 'black');
});
$('#test').bind('touchend', function() {
$(this).css('background-color', 'white');
});
谢谢!
【问题讨论】:
-
你使用的是什么版本的jQuery文件?