Bri*_*ian 5 javascript css jquery slideup internet-explorer-7
所以我使用了一个非常基本的jQuery .slideDown,它在FF,Safari和Chrome中运行良好.在IE7中根本不起作用.这是脚本:
//Top Mailing List Drop down animation
$(document).ready(function() {
$('div#top_mailing_hidden').hide();
// Expand Panel
$("input#top_mailing").focus(function(){
$("div#top_mailing_hidden").slideDown("slow");
});
// Collapse Panel
$("input#top_mailing").blur(function(){
$("div#top_mailing_hidden").slideUp("slow");
});
});
Run Code Online (Sandbox Code Playgroud)
我已经研究了几个小时,发现了一些与滑动/缩小有关的错误,导致它在用于postion的后代时在IE7中失败:固定元素.这个动画发生在一个位置:固定的导航栏,但是,我已经尝试用位置包装内部元素:相对但无济于事,我仍然在IE中得不到任何东西.另外,请注意nav元素是用jQuery隐藏的,即使在IE7中该函数也能正常工作,但是,滑动/缩小不是.
这是相关的CSS:
/* --------------Top Dropdown Mailing List------------------- */
#top_nav div#top_mailing{
float: right;
width: 351px;
padding: 0 10px 10px 5px;
background: url(images/top_mailing_bg.png) bottom center no-repeat;
position: absolute;
top: 0;
right: 0;
color: #fff;
text-shadow:0 -1px 0px #222;
}
#top_mailing #top_mailing_hidden{
font-size: .7em;
text-align: center;
position: relative;
height: 30px;
zoom: 1;
}
#top_mailing #top_mailing_hidden div{
}
#top_mailing #top_mailing_hidden a{
color: #acffc0;
font-weight: bold;
}
#top_mailing #top_mailing_visible{
height: 30px;
font-weight: bold;
font-size: .9em;
padding-top: 5px;
}
Run Code Online (Sandbox Code Playgroud)
Bob*_*ger 22
jQuery的slideUp(),slideDown()并且slideToggle()不与工作position:relative中的元素IE7.可以通过添加来解决一些幻灯片问题
zoom: 1;
Run Code Online (Sandbox Code Playgroud)
滑动容器和/或元件.
我们不得不恢复使用<table>进行布局来解决一些滑动问题.
在我的示例中出现此行为的原因是 IE 无法识别我用来触发 .slideUp/Down 的 .focus。我在这里找到了一个很好的答案来解释这个问题,但是这允许您在焦点上添加一个CSS类,但是我需要在.focus上使用slideUp/Down为一个单独的元素设置动画,因此CSS类对我的情况没有帮助,有人有想法吗?
知道了!我必须使用 mouseenter 而不是 focus,但这里是完整的脚本,其中包含魔鬼(又名 IE)的条件 mouseenter 事件:
//Top Mailing List Drop down animation
$(document).ready(function() {
if (jQuery.browser.msie === true) {
jQuery('#top_mailing')
.bind("mouseenter",function(){
$("#top_mailing_hidden").slideDown('slow');
}).bind("mouseleave",function(){
$("#top_mailing_hidden").slideUp('slow');
});
}
$('#top_mailing_hidden').hide();
// Expand Panel
$("input#top_mailing").focus(function(){
$("#top_mailing_hidden").slideDown("slow");
});
// Collapse Panel
$("input#top_mailing").blur(function(){
$("#top_mailing_hidden").slideUp("slow");
});
});
Run Code Online (Sandbox Code Playgroud)