firefox:悬停时选择标签的选项消失

时间:2018-11-04 11:13:36

标签: firefox select mousehover

当鼠标悬停选择输入时,我在firefox上遇到奇怪的行为(在chrome上没问题)。 我有一个跨度,如果鼠标悬停了它,我将其替换为选择感谢的javascript和jquery。它可以正常工作,但是当我的鼠标移动到某个选项上时,select消失了,文本再次出现。

Here a gif to explain this behaviour

还有一个演示代码:

<head>
    <meta charset="UTF-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <style>
        .switch_show_hidden .switch_show {
        }
        .switch_show_hidden .switch_hidden {
            display: none;
        }
    </style>
    <script>
        $(document).ready(function () {
            $(".switch_show_hidden").hover(function() {
                $(this).find(".switch_show").hide();
                $(this).find(".switch_hidden").show();
            },
            function() {
                $(this).find(".switch_show").show();
                $(this).find(".switch_hidden").hide();
            });
        });
    </script>
    <title>Test</title>
</head>
<body>
    <div class="switch_show_hidden">
        <span class="switch_show">Value 3</span>
        <select class="switch_hidden form-control change_user_role">
            <option value="1">Value 1</option>
            <option value="1">Value 2</option>
            <option value="1" selected="selected">Value 3</option>
            <option value="1">Value 4</option>
            <option value="1">Value 5</option>
        </select>
    </div>
</body>
</html>

这是来自firefox的错误吗?有解决此问题的解决方法吗?

谢谢丹尼斯

0 个答案:

没有答案