JQuery : How to combine motion with fadeout
I have an image of an arrow which I want, onclick, to move the left say 200px and - wh开发者_StackOverflow中文版ile it is moving it should fade to 0 opacity.
So far I have:
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', width: 'toggle'}, speed,
easing, callback);
};
which kind of works, but it does not move the object it reduces it's width instead. How do I achieve the effect of "motion" with a fade at the same time?
Shouldn't you change width
to left
?
Like this
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', left: 'toggle'}, speed, easing, callback);
};
Try JQuery UI. It ships with a lot of nice effects...
精彩评论