jquery - Firefox 中的事件 CSS 伪类和 iscroll 问题

标签 jquery css jquery-mobile pseudo-class iscroll

我正在开发一个移动网站。我正在使用 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。您确定需要同时加载两个库吗?

如果您更改加载库的顺序,那么一切都会正常,您将获得所需的结果:

Working Example

除此之外,我可以为您提供另一种解决方案,即使用 jQuery 来获得所需的效果,因为我没有看到任何其他可行的可能性:

$(document).ready(function() {
    $("p").mousedown(function() {
        $(this).addClass('hovered');
    }).mouseup(function() {
        $(this).removeClass('hovered');
    });
});

Working Example 2

更新:

引用您的上一条评论,这是我为您提供的最终解决方案:

$(document).ready(function() {
    $("p").mousedown(function() {
        hovered = true;
        $(this).addClass('hovered');
    });
    $(document).mouseup(function() {
        if (hovered === true) {
            $("p").removeClass('hovered');
            hovered = false;
        }
    });
});

Working Example 3

关于jquery - Firefox 中的事件 CSS 伪类和 iscroll 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12388596/

相关文章:

jquery - 隐藏后与 jQuery 内联显示的元素的 Webkit 错误

缩小视口(viewport)时 CSS 定位很奇怪

html - CSS 背景图像对齐问题

android - PhoneGap AdMob 插件中 undefined variable admob

javascript - 在 Jquery 中渲染图像抛出 500(内部服务器错误)

javascript - 如何 : Pause and Play flexslider based on click event (jQuery)

jQuery mobile多选菜单显示项?

java.lang.IllegalArgumentException : the bind value at index 1 is null

javascript - 让 URL 开始选择下拉列表

html - 防止列表项填充在水平列表中换行