JQuery Cycle无法在IE,Safari或移动浏览器中运行。适用于FF和Chrome

时间:2011-05-18 00:29:51

标签: jquery internet-explorer mobile safari cycle

我试过通过w3c验证器运行它,似乎无法找到我的错误。我希望一些额外的眼睛能找到我做错的事。

JQuery的

$(function() { 
$('#play').click(function() { $('#slides').cycle('toggle'); return false; });   

$('#slides').cycle({ 
    fx:    'none',
prev:  '#prev',
next:  '#next', 
    speed: '1000', 
    timeout: 2000 
}); 

$('#slides').cycle('pause');

$('.pause').toggle(
  function() {
    $('#pausectrl').attr({src: 'images/pause1.png', class: 'paused'});
  },
  function() {
    $('#pausectrl').attr({src: 'images/play1.png', class: 'playing'});
  }
);

$('.playing').live("mouseover", function() {
  $(this).attr('src','images/play2.png');
});

$('.playing').live("mouseout", function(){
  $(this).attr('src','images/play1.png');
});

$('.paused').live("mouseover", function() {
  $(this).attr('src','images/pause2.png');
});

$('.paused').live("mouseout", function(){
  $(this).attr('src','images/pause1.png');
}); });

您可以在此处查看此页面MMA Sample Slideshow

1 个答案:

答案 0 :(得分:2)

对于Internet Explorer,您必须在“类”标识符中添加引号。

将您的class更改为"class",这应该有效;)

实施例: $('#pausectrl').attr({src: 'images/play1.png', class: 'playing'}); 变为$('#pausectrl').attr({src: 'images/play1.png', "class": 'playing'});