JQuery Replace Left Shift Element

They currently use the fadeOut animation effect to replace the contents of a div element.

 $('#divID').fadeOut('slow', function(){ $(this).replaceWith( $div ); }); 

How can I achieve the slide to left effect when replacing the contents of a div element?

+4
source share
1 answer

I don’t know if there is a certain effect for this, I used $().animate({left: val}) to achieve this.

 var width = $(window).width(); $('#divID').animate({left : -width}, 500, function(){ $div.hide() }); $div.css({left: width}).show().animate({left: 0}, 500); 

You need to set the css for your elements to position: absolute and set up containers and other elements.

Here is jsfiddle

+12
source

All Articles