jQuery的替换元素瓦特/向左滑动效果 [英] JQuery Replace Element w/ Slide Left Effect

查看:92
本文介绍了jQuery的替换元素瓦特/向左滑动效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我在替换div元素的内容时使用了fadeOut动画效果.

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

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

替换div元素的内容时如何实现slide to left效果?

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

推荐答案

不知道这是否有特定效果,我使用$().animate({left: val})来实现.

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);

您需要将元素的css设置为position: absolute,并调整容器和其他项目.

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

这是 jsfiddle

这篇关于jQuery的替换元素瓦特/向左滑动效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆