I\'m using jQuery 1.5.1 This is my code:
$(\'.cellcontent\').animate({
left: \'-=190\'}, {
easing: alert(\'start ani\'),
duration: 5000,
complete
Best solution is this.
$('.cellcontent').animate({
left: '-=190'}, {
easing: alert('start ani')
}, duration).promise().done(function () {
alert('end animation');
});
from the jquery docs:
$( "#clickme" ).click(function() {
$( "#book" ).animate({
opacity: 0.25,
left: "+=50",
height: "toggle"
}, 5000, function() {
// Animation complete.
});
});
I dont think you need "complete"?
slideToggle(
"fast","swing", function(){
// your code here
}
);
$('.cellcontent').animate({
left: '-=190',
easing: 'slow',
duration: 5000,
function () {
alert('end ani');
}
});
I see two things wrong with this.
One, easing
should be:
A string indicating which easing function to use for the transition
And complete
should be a function.
http://api.jquery.com/animate
alert('start ani');
$('.cellcontent').animate({
left: '-=190'
},
{
easing: 'swing',
duration: 5000,
complete: function(){
alert('end ani');
}
});
You need to pass a function to call. Instead you are calling the function.
complete: function() { alert('end ani'); }