【问题标题】:why the select options disappears and how i can i fix it为什么选择选项消失了,我该如何解决
【发布时间】:2013-12-15 10:31:36
【问题描述】:

http://jsfiddle.net/nofear87/uBEDA/

$('#produceMenu').mouseover(function(){
       $('#produceMenu').show();
    }).mouseout(function(){
       $('#produceMenu').hide();
    });

$('#menuProduce').mouseover(function() {
        var pos = $('#productionMenu').position();
        $('#produceMenu').css({
            "top" : pos.top + "px",
            "left": (pos.left + 111) + "px"
        });
        $('#produceMenu').show();
    }).mouseout(function() {
        $('#produceMenu').hide();
    });

为什么选择选项会消失,我该如何解决。在 Firefox 中它可以工作......但在 chrome 中它消失了。 在ie中的孔样本不起作用...不知道为什么,在ie中鼠标悬停有什么问题吗?

非常感谢!

【问题讨论】:

  • 当我使用 jquery 1.8.3 而不是 1.10.1 时,我修复了 ie 鼠标悬停问题。但这是什么原因?

标签: jquery internet-explorer google-chrome firefox select


【解决方案1】:

而不是 mouseover , mouseout 使用 mouseenter 和 mouseleave

    $('#produceMenu').mouseenter(function(){
           $('#produceMenu').show();
        }).mouseleave(function(){
           $('#produceMenu').hide();
    });

    $('#menuProduce').mouseenter(function() {
            var pos = $('#productionMenu').position();
            $('#produceMenu').css({
                "top" : pos.top + "px",
                "left": (pos.left + 111) + "px"
            });
            $('#produceMenu').show();
        }).mouseleave(function() {
            $('#produceMenu').hide();
        });

检查编辑Fiddle

【讨论】:

  • 谢谢,但它并没有解决ie 10中的问题。也许它失败是绝对定位?但后来我不明白为什么它在较低的 jquery 版本中工作
  • 但它解决了 chrome 中的选择问题,谢谢 ;-)
  • jsfiddle.net/nofear87/uBEDA/23 我找到了另一种解决方案,但我并不完美,选择没有消失,但菜单对鼠标悬停没有反应。
猜你喜欢
  • 2015-11-02
  • 1970-01-01
  • 2019-12-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-06
  • 2014-11-23
  • 2021-08-29
相关资源
最近更新 更多