【问题标题】:Simple function is not working in Chrome 57.0.2977.98 (64bit)简单功能在 Chrome 57.0.2977.98(64 位)中不起作用
【发布时间】:2017-03-27 18:06:46
【问题描述】:

我有一个非常简单的函数,可以在 Safari 和 Firefox 中完美运行,但在 Chrome 中却不行。

任何帮助将不胜感激。也许同样的功能可以用其他方式编写?

$(document).on("mouseenter", "#menumore", function() {
    $("#menumore span").addClass("black")
})

$(document).on("mouseleave", "#menumore", function() {
    $("#menumore span").removeClass("black")
})
#menumore{font-family:Arial; font-size:60px;corsor:pointer;}
.white{opacity:0;transition:opacity .2s cubic-bezier(0.77,0,0.175,1)}
.black{opacity:1}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id=menumore>M<span class=white>ENU</span></div>

【问题讨论】:

  • 在 chrome 中为我工作
  • 我建议为此使用 CSS
  • 控制台出现什么错误?
  • 在基于 webkit 的 Opera 中也能正常工作。
  • 我没有收到任何错误,它只是没有按应有的方式显示 .shite 类。 @Rajesh 我很想听听更多:)

标签: javascript jquery css


【解决方案1】:

按照建议,您应该尝试使用 CSS。

#menumore {
  font-family: Arial;
  font-size: 60px;
  corsor: pointer;
}

.white {
  opacity: 0;
  transition: opacity .2s cubic-bezier(0.77, 0, 0.175, 1)
}

#menumore:hover .white {
  opacity: 1
}
&lt;div id=menumore&gt;M&lt;span class=white&gt;ENU&lt;/span&gt;&lt;/div&gt;

【讨论】:

    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-27
    • 2014-11-20
    • 2012-11-08
    • 2023-03-18
    相关资源
    最近更新 更多