Javascript jQuery在调整大小后设置动画

Javascript jQuery在调整大小后设置动画,javascript,jquery,html,css,centering,Javascript,Jquery,Html,Css,Centering,我正在使用并尝试在图像居中后设置动画 这是我的代码,图像居中工作,但动画不 $('#myimage').css('opacity' , 0); $('#myimage').centerImage(function() { //At this point, resize is complete, and the element is invisible $(this).animate({opacity: 1}, 1500 ); }); 根据,第二个参数是回调,第一个参数是居中方法。所以试

我正在使用并尝试在图像居中后设置动画

这是我的代码,图像居中工作,但动画不

$('#myimage').css('opacity' , 0);
$('#myimage').centerImage(function() {
  //At this point, resize is complete, and the element is invisible
  $(this).animate({opacity: 1}, 1500 );
});
根据,第二个参数是回调,第一个参数是居中方法。所以试试看

var $img =$('#myimage');
$img.css('opacity', 0);

$img.centerImage('inside', function () { //give inside or for no method just provide undefined or ""
      //At this point, resize is complete, and the element is invisible
    $(this).animate({
        opacity: 1
    }, 1500);
});

还请记住,您可以像在演示中一样链接em。

控制台上有任何错误吗?没有,没有firebug@Darko不客气。若你们不介意或者并没有得到另一个更好的答案,请记得标记为答案。