gpt4 book ai didi

jquery - 菜单悬停效果在 IE 中不起作用

转载 作者:行者123 更新时间:2023-11-28 11:37:05 24 4
gpt4 key购买 nike

我正在从事使用悬停菜单的元素。这在 Chrome 和 FF 中运行良好。但现在在 IE7 和 IE8 中工作。此菜单动态绑定(bind)到表单。如下所示。

enter image description here

您看到的任何菜单效果都在 Chrome 中正常运行。但不是在 IE 中,如下所示。

enter image description here

我的 CSS 文件如下。

/* reset  list style */
.cbp-tm-menu,
.cbp-tm-menu ul {
list-style: none;
}

/* set menu position; change here to set to relative or float, etc. */
.cbp-tm-menu {
font-family: "Bebas Neue";
font-size: 16px;
color: #FFFFFF;
text-decoration: none;
text-transform: uppercase;
background-color:#2b343b;
margin:0;

}

/* first level menu items */
.cbp-tm-menu > li {
display: inline-block;
position: relative;
padding-left:21px;

}

.cbp-tm-menu > li > a {
line-height: 3em;
padding-right:1em;
font-size: 23px;
display: block;
color: #fff;

}

.no-touch .cbp-tm-menu > li > a:hover,
.no-touch .cbp-tm-menu > li > a:active {
color: #e82c5c;
}

/* sumbenu with transitions */
.cbp-tm-submenu {
position: absolute;

visibility: hidden;
opacity: 0;
padding: 0;
text-align: left;
pointer-events: none;
-webkit-transition: visibility 0s, opacity 0s;
-moz-transition: visibility 0s, opacity 0s;
transition: visibility 0s, opacity 0s;

}

.cbp-tm-show .cbp-tm-submenu {
width: 10em;
left: 30%;
margin: 0 0 0 -8em;
opacity: 1;
visibility: visible;
pointer-events: auto;
-webkit-transition: visibility 0s, opacity 0.3s;
-moz-transition: visibility 0s, opacity 0.3s;
transition: visibility 0s, opacity 0.3s;
}

.cbp-tm-show-above .cbp-tm-submenu {
bottom: 100%;
padding-bottom: 10px;
}

.cbp-tm-show-below .cbp-tm-submenu {
top: 100%;
padding-top: 10px;
}
.cbp-tm-menu > li:hover
{
background-color: Gray;

}


/* extreme cases: not enough space on the sides */
.cbp-tm-nospace-right .cbp-tm-submenu {
right: 0;
left: auto;
}

.cbp-tm-nospace-left .cbp-tm-submenu {
left: 0;
}

/* last menu item has to fit on the screen */
.cbp-tm-menu > li:last-child .cbp-tm-submenu {
/*right: 0;*/
}

/*
arrow: depending on where the menu will be shown, we set
the right position for the arrow
*/

.cbp-tm-submenu span {
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;

}
.cbp-tm-show-above .cbp-tm-submenu span{
border-top-color: #fff;
}

.cbp-tm-show-below .cbp-tm-submenu span{
border-bottom-color: #fff;
}
.cbp-tm-show-above .cbp-tm-submenu span {
top: 100%;
margin-top: -10px;
}

.cbp-tm-show-below .cbp-tm-submenu span {
bottom: 100%;
margin-bottom: -10px;
}
.cbp-tm-submenu span {
border-color: transparent;
border-width: 16px;
margin-left: -26px;
left: 64px;
}

.cbp-tm-submenu > li {
display: block;
background: #fff;
}
.cbp-tm-submenu > li > a {
padding: 5px 0px 5px 0.6em; /* top/bottom paddings in 'em' cause a tiny "jump" in Chrome on Win */
display: block;
font-size: 16px;
position: relative;
color: #e82c5c;

-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
transition: all 0.2s;
}

.no-touch .cbp-tm-submenu > li > a:hover,
.no-touch .cbp-tm-submenu > li > a:active {
color: #fff;
background: #e82c5c;
}
/* the icons (main level menu icon and sublevel icons) */
.cbp-tm-submenu li a:before,
.cbp-tm-menu > li > a:before {
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
vertical-align: middle;
margin-right: 0.6em;
-webkit-font-smoothing: antialiased;
}

.cbp-tm-submenu li a:before {
position: absolute;
top: 50%;
margin-top: -0.5em;

}
.cbp-tm-menu > li > a:not(:only-child):before {
opacity: 0.3;
}


/* Media Queries */
@media screen and (max-width: 55.6875em) {
.cbp-tm-menu {
font-size: 80%;
}
}

@media screen and (max-height: 25.25em), screen and (max-width: 44.3125em) {

.cbp-tm-menu {
font-size: 100%;
position: relative;
text-align: center;
padding: 0;
top: auto;
}

.cbp-tm-menu > li {
display: block;
margin: 0;
border-bottom: 4px solid #000;
}

.cbp-tm-menu > li:first-child {
border-top: 4px solid #000;
}

li.cbp-tm-show > a,
.no-touch .cbp-tm-menu > li > a:hover,
.no-touch .cbp-tm-menu > li > a:active {
color: #fff;
background: #000;
}

.cbp-tm-submenu {
position: relative;
display: none;
width: 100%;

}

.cbp-tm-submenu > li {
padding: 0;
}

.cbp-tm-submenu > li > a {
padding: 0.6em 2.3em 0.6em 0.6em;
border: none;
border-bottom: 2px solid #000;
}

.cbp-tm-submenu:after {
display: none;
}

.cbp-tm-menu .cbp-tm-show .cbp-tm-submenu {
display: block;
width: 100%;
left: 0;
margin: 0;
padding: 0;
}

}

这是我的 http://jsbin.com/eyUjUHET/4/ .

最佳答案

您缺少 IE 的 CSS 渲染引擎。不同的浏览器有不同的渲染引擎。

  1. Chrome-webkit
  2. Firefox -moz
  3. Opera -据我所知,opera已经改用开源-webkit渲染引擎。
  4. Internet 浏览器。我认为 Internet Explorer 使用 Trident Rendering Engine。

-webkit-transition: 可见性 0s,不透明度 0.3s;

-moz-transition: 可见度0s,不透明度0.3s;

您应该在您的 CSS 中使用 Trident 引擎,就像您在 chrome 中使用 webkit 引擎一样。

关于jquery - 菜单悬停效果在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20865477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com