因此,我使用的是一个非常基本的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");
});
});我已经研究了几个小时,发现了一个与滑动/向下相关的bug,它在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;
}发布于 2009-12-02 04:35:02
在我的示例中,出现这种行为的原因是IE不识别.focus,而我用它来触发. .slideUp/Down。我找到了一个很好的答案来解释这个问题here,但是这允许您在焦点上添加一个CSS类,但是我需要在.focus上用滑动向上/向下的方式动画一个单独的元素,这样CSS类对我的情况没有帮助,有人有想法吗?
明白了!我不得不使用mouseenter而不是focus,但是下面是带有条件mouseenter事件的完整脚本。IE:
//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");
});
});发布于 2011-01-15 10:35:16
jQuery的position:relative、slideDown()和slideToggle()不能在IE7中使用元素。一些幻灯片问题可以通过添加
zoom: 1;到滑动容器和/或元素。
我们不得不恢复使用来布局,以解决一些滑动问题。
https://stackoverflow.com/questions/1830328
复制相似问题