JQuery Replace Element w/ Slide Left Effect

我是研究僧i 提交于 2019-12-10 15:31:42

问题


Currently im using fadeOut animation effect in replace content of a div element.

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

How can I achieve slide to left effect when replace content of the div element?


回答1:


Don't know if there is a specific effect for that, I used $().animate({left: val}) to achieve that.

var width = $(window).width();

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

You will need to set your elements' css to position: absolute, and tune the containers and other items.

Here is a jsfiddle



来源:https://stackoverflow.com/questions/15063125/jquery-replace-element-w-slide-left-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!