2011-06-02 76 views
0

基本上得到这一点的代码,在ie8 &低于工作。jquery .next *?*问题

自动更改会淡出当前的文本块,但不会淡入新文本,这使得我认为它正在播放的.next(),因为单击数字(.click函数)可以正常工作。

的jQuery:

function doSlideshow() { 
    if ($('.image_links a.selected').attr("rel") == "five") { 
     the = $('.image_links a:first'); 
    } else { 
     the = $('.image_links a.selected').next('a'); 
    } 
    $('.image_links a.selected').removeClass("selected"); 
    $(the).addClass("selected"); 
    var theNum = $(the).attr("rel"); 
    $('.image_area .images img:not(.visible)').removeClass().addClass("reset"); 
    $('.image_area .images img#' + theNum).removeClass().addClass("que"); 
    $('.image_area .images img.visible').fadeOut(500, function() { 
     $('.image_area .images img.visible').removeClass().attr("style", "display:block;").addClass("reset"); 
     $('.image_area .images img.que').removeClass("que").addClass("visible") 
    }); 
    $('.image_area .content .text').fadeOut(); 
    $('.image_area .content .text.' + theNum).fadeIn(); 
    thistimeout = setTimeout('doSlideshow()', 6000); 
    return false; 
} 
$(function() { 
    thistimeout = setTimeout('doSlideshow()', 6000); 
    $('.image_area .images img').removeClass().addClass("reset"); 
    $('.image_area .images img#one').removeClass().addClass("visible"); 
    $('.image_links a').click(function() { 
     clearTimeout(thistimeout); 
     if ($(this).hasClass("selected")) { 
      return false; 
     } 
     $('.image_links a.selected').removeClass("selected"); 
     $(this).addClass("selected"); 
     var theNum = $(this).attr("rel"); 
     $('.image_area .content .text').fadeOut(); 
     $('.image_area .content .text.' + theNum).fadeIn(); 
     $('.image_area .images img:not(.visible)').removeClass().addClass("reset"); 
     $('.image_area .images img#' + theNum).removeClass().addClass("que"); 
     $('.image_area .images img.visible').fadeOut(500, function() { 
      $('.image_area .images img.visible').removeClass().attr("style", "display:block;").addClass("reset"); 
      $('.image_area .images img.que').removeClass("que").addClass("visible") 
     }); 
     thistimeout = setTimeout('doSlideshow()', 6000); 
     return false; 
    }); 
}); 

这里是链接: http://b2j3new.zen-host.com 受影响的区域是顶级图像转换。在webkit/gecko中正常工作

Mucho unaato!

+3

不要将字符串传递给'setTimeout'。 – SLaks 2011-06-02 16:41:44

+0

嗨SLaks,我已经拿出了字符串,并将其设置为只是功能,仍然没有运气..谢谢反馈。 – rickyduck 2011-06-02 16:49:30

回答

1

尝试更换(2处)

thistimeout = setTimeout('doSlideshow()', 6000); 

有:

thistimeout = setInterval(function() {doSlideshow();}, 6000); 

从doSlideshow删除:

thistimeout = setTimeout('doSlideshow()', 6000); 

而变化:

clearTimeout(thistimeout); 

要:

clearInterval(thistimeout); 

让我知道是否有帮助。

+0

嗨仁,不幸的是,也没有工作,它看起来像函数正在工作 - 因为他们都fadeOut,但接下来的元素不淡入。感谢您的持续帮助! – rickyduck 2011-06-03 05:22:55

0

它看起来像IE 8没有运行你doSlideshow功能。

这是一个远射,但是你在javascript中缺少了几个分号。我以前看过IE对这类东西很敏感,但是就像我说的那样,这是一个触手可及的东西。

修复两行不以分号结尾的行。

$('.image_area .images img.que').removeClass("que").addClass("visible") 

$('.image_area .images img.que').removeClass("que").addClass("visible") 
+0

嗨,谢谢你的回应。我放弃了,但无济于事。很奇怪! – rickyduck 2011-06-02 17:05:13

+0

您是否尝试过验证标记? IE也被称为与js混合无效标记奇怪的事情。 – 2011-06-02 17:13:57

+0

这并没有解决它:(哇这是痛苦的!哈 – rickyduck 2011-06-02 17:20:31