【发布时间】:2014-01-18 20:52:21
【问题描述】:
我正在处理我使用悬停菜单的项目。在 Chrome 和 FF 中运行良好。但现在在 IE7 和 IE8 中工作。此菜单动态绑定到表单。如下图。
您看到的任何菜单效果都在 Chrome 中发生。但在 IE 中不行,如下图。
我的 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;
}
}
【问题讨论】:
-
如果您还没有解决问题,请发布站点链接或找我们来帮助您。这将有助于调试。
-
@Kirk- 我已经动态绑定了它......
-
@Kirk- 看看 jsfiddle...我已经更新了它
-
Chrome 上也没有显示下拉菜单?
-
@nop 它也在 chrome 中显示它......我上传了错误的 js....
标签: jquery asp.net css internet-explorer menu