Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery动画在IE8中无法正常运行_Jquery_Html_Css_Internet Explorer - Fatal编程技术网

jQuery动画在IE8中无法正常运行

jQuery动画在IE8中无法正常运行,jquery,html,css,internet-explorer,Jquery,Html,Css,Internet Explorer,似乎无法解决这个问题。在FF、Chrome等方面表现出色。。有人知道这里出了什么问题吗?不仅滚动和图像链接不起作用,导航栏也变得一团糟。正常情况下,我只会笑着发布旧的获取新的浏览器链接,但不幸的是,我没有这个链接的奢侈 月亮 /*预加载,如果你喜欢的话*/ (函数($){ var缓存=[]; //参数是相对于当前页面的图像路径。 $.PRELOIMAGES=函数(){ var args_len=arguments.length; 对于(var i=args_len;i--;){ var ca

似乎无法解决这个问题。在FF、Chrome等方面表现出色。。有人知道这里出了什么问题吗?不仅滚动和图像链接不起作用,导航栏也变得一团糟。正常情况下,我只会笑着发布旧的获取新的浏览器链接,但不幸的是,我没有这个链接的奢侈


月亮
/*预加载,如果你喜欢的话*/
(函数($){
var缓存=[];
//参数是相对于当前页面的图像路径。
$.PRELOIMAGES=函数(){
var args_len=arguments.length;
对于(var i=args_len;i--;){
var cacheImage=document.createElement('img');
cacheImage.src=参数[i];
cache.push(cacheImage);
}
}
})(jQuery)
jQuery.preload图像(
“img/moons/a0.png”,
“img/moons/a1.png”,
“img/moons/a2.png”,
“img/moons/a3.png”,
“img/moons/a4.png”,
“img/moons/a5.png”,
“img/moons/a6.png”,
“img/moons/p0.png”,
“img/moons/p1.png”,
“img/moons/p2.png”,
“img/moons/p3.png”,
“img/moons/p4.png”,
“img/moons/p5.png”,
“img/moons/p6.png”
);
/*链接绑定的悬停操作*/
函数evMouseOver(i){
控制台日志(i);
$('#moon img').eq(i).attr('src','img/moons/a'+i+'.png');
$('ul#nav li').eq(i).addClass('hover');
}
函数evMouseOut(i){
$('#moon img').eq(i).attr('src','img/moons/p'+i+'.png');
$('ul#nav li').eq(i).removeClass('hover');
}
/*如果未指定图像大小,则必须在$(window).load()处调用*/
$().ready(函数()){
美元("nav").法代因(2000),;
var原始位置=[];
var parent_width=$('#moon').width();
var parent_pos=$('#moon').offset();
/*设置列表以响应彼此的悬停事件*/
$('.hoverbind').children().each(函数(i){
i=$(this.index();
$(此)。悬停(
函数(){
evMouseOver(i);
},
函数(){
evMouseOut(i);
}
);
/*为IMGs和LIs启用远程单击(使用的HREF将是UL中的HREF)*/
$(此项)。单击(
函数(){
parent.location=$('ul#nav li').eq(i).children('a').attr('href');
}
);
});
$('#moon img')。每个(函数(){
el=$(本);
/*保留子对象的默认位置*/
原始位置=标高偏移();
/*将所有人移到中间:Lc=Lp+(Wp-Wc)/2*/
标高偏移({
“左”:父项位置左+(父项宽度-此宽度)/2,
“顶部”:原始位置顶部
});
/*淡入*/
动画片(
{
“不透明度”:1
}
);
/*把每个人带回到他们开始的地方*/
动画片(
{
“左”:0,//(原始位置左-父位置左)-(原始位置左-父位置左),//哪个当然=0…WTF?这有意义吗???
“顶部”:0/(原始位置顶部-父位置顶部)
},
{
“持续时间”:6000,
“完成”:函数(){}
}
);
});
});

您的变量i在IE中超出了范围。只需在悬停函数中使用$(this).index(),如下所示

$('.hoverbind').children().each(function(i) {
    //i = $(this).index();
    $(this).hover(
        function () {
            $(this).attr('src', 'img/moons/a' + $(this).index() + '.png');
            $('ul#nav li').eq($(this).index()).addClass('hover');
            //evMouseOver(i);
        },
        function()  {
            $(this).attr('src', 'img/moons/p' + $(this).index() + '.png');
            $('ul#nav li').eq($(this).index()).removeClass('hover');
            //evMouseOut(i);
        }
    );
或者,只需按如下方式绑定鼠标悬停:

$(this).hover(evMouseOver, evMouseout);
然后将当前每个匿名函数块中的代码逐字移动到那里


我没有费心彻底检查,但导航栏看起来像是IE7唯一的问题,可能可以通过一些CSS更改来修复。只需将LI元素以固定宽度向左浮动,将UL边距:0自动居中,它应该显示良好。

您的变量i在IE中超出范围。只需在悬停函数中使用$(this).index(),如下所示

$('.hoverbind').children().each(function(i) {
    //i = $(this).index();
    $(this).hover(
        function () {
            $(this).attr('src', 'img/moons/a' + $(this).index() + '.png');
            $('ul#nav li').eq($(this).index()).addClass('hover');
            //evMouseOver(i);
        },
        function()  {
            $(this).attr('src', 'img/moons/p' + $(this).index() + '.png');
            $('ul#nav li').eq($(this).index()).removeClass('hover');
            //evMouseOut(i);
        }
    );
或者,只需按如下方式绑定鼠标悬停:

$(this).hover(evMouseOver, evMouseout);
然后将当前每个匿名函数块中的代码逐字移动到那里

我没有费心彻底检查,但导航栏看起来像是IE7唯一的问题,可能可以通过一些CSS更改来修复。只需将LI元素以固定宽度向左浮动,将UL边距:0自动居中,它应该显示良好