I was using:
Data.$notification
.delay(1500)
.animate({
right: '+=' + (Data.$notification.width() + 45)
}, 700)
.delay(2500)
.animate({
right: '-=' + (Data.$notification.width() + 45)
}, 700, function() {
$(this).remove();
});
But it’s not smooth enough, so taking peoples advice I want to use translate 3D css.
ATM I can’t get it working, I’ve tried:
Data.$notification
.delay(1500)
.addClass('move-into-view')
.delay(2500)
.removeClass('move-into-view').addClass('move-outof-view')
.delay(1500)
.remove();
Where
.rotate-notification.move-into-view {
-webkit-transform: translate3d(-175px, 0, 0);
}
.rotate-notification.move-outof-view {
-webkit-transform: translate3d(175px, 0, 0);
}
Is this actually possible? or am I going about this the wrong way?
.delay()only works with a queue:Source: http://api.jquery.com/delay/
So a suggested route would be:
Also you need to set a
transitionrule in your CSS for an animation:Here is a demo: http://jsfiddle.net/vJHvA/4/
Note that if you don’t use something like Modernizr to check browser compatibility and adapt accordingly then you can break functionality in browsers other than Mobile Safari (for example the Android Browser which is also a WebKit browser).