开发者

Jquery animate not working in IE?

开发者 https://www.devze.com 2023-03-26 02:44 出处:网络
I\'m using jquery to animate a background position of an image, it works in modern browsers but not in IE. Any help is much appreciated, thanks :)

I'm using jquery to animate a background position of an image, it works in modern browsers but not in IE. Any help is much appreciated, thanks :)

$("#btn-home").click(function(){
  $('#line').animate({backgroundPosition: '0px 0', duration:2000});
  })
  $("#btn-intro").click(function(){
  $('#line').animate({backgroundPosition: '116px 0', duration:2000});
  })
  $("#btn-prizes").click(function(){
        $('#line').animate({backgroundPosition: '231px 0', duration:2000});
      })
    $("#btn-part").click(function(){
        $('#line').animate({backgroundPosit开发者_StackOverflow中文版ion: '345px 0', duration:2000});
      })
    $("#btn-prog").click(function(){
        $('#line').animate({backgroundPosition: '460px 0', duration:2000});
      })
    $("#btn-judge").click(function(){
        $('#line').animate({backgroundPosition: '575px 0', duration:2000});
      })
    $("#btn-past").click(function(){
        $('#line').animate({backgroundPosition: '690px 0', duration:2000});
      })


Try this

$('#line').animate({backgroundPosition: '345px 0'}, 2000);


$("#btn-home").click(function(){
  $('#line').animate({backgroundPosition: '0px 0', duration:2000});
  })

Is Wrong.

I don't think there is anything such as duration: {NUMBER} in Animate.

Try:

$("#btn-home").click(function(){
  $('#line').animate({backgroundPosition: '0px 0', 2000});
  })
0

精彩评论

暂无评论...
验证码 换一张
取 消