我正在开发一个移动网站。我正在使用 Jquery mobile 和 iscroll 插件。在 Chrome 中一切都运行良好。但是在检查 Firefox 时,我发现为元素编写的 :active css 样式不起作用。
这是 fiddle http://jsfiddle.net/zq5AW/
事件效果在 Chrome 中有效,但在 Firefox 中无效。
但是当我删除 jquery.mobile.iscrollview-min.js 包含行时。它也开始在 Firefox 中工作。有人可以建议修复吗?
Note: Same question was found on googling
https://groups.google.com/forum/?fromgroups=#!topic/iscroll/lqPomh3y-TU
But there was no answers.
最佳答案
Mithunsatheesh,两个库之间存在冲突 - jQuery 和 jQuery Mobile。您确定需要同时加载两个库吗?
如果您更改加载库的顺序,那么一切都会正常,您将获得所需的结果:
除此之外,我可以为您提供另一种解决方案,即使用 jQuery 来获得所需的效果,因为我没有看到任何其他可行的可能性:
$(document).ready(function() {
$("p").mousedown(function() {
$(this).addClass('hovered');
}).mouseup(function() {
$(this).removeClass('hovered');
});
});
更新:
引用您的上一条评论,这是我为您提供的最终解决方案:
$(document).ready(function() {
$("p").mousedown(function() {
hovered = true;
$(this).addClass('hovered');
});
$(document).mouseup(function() {
if (hovered === true) {
$("p").removeClass('hovered');
hovered = false;
}
});
});
关于jquery - Firefox 中的事件 CSS 伪类和 iscroll 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12388596/