本文介绍了jQuery:如何执行“推送"操作滑动,而不是向上滑动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下JQuery:

I using the following JQuery:

$("#pushSlideDiv").slideDown("fast");

但是,这会产生滑动"效果.意思是,如果我执行slidedown,这将使下划线的DIV从上到下显示其自身.

However, this creates a "slide" effect. Meaning, if I do a slidedown, this makes the underlining DIV reveal it's self from a top-to-bottom reveal.

我想要一个推"效果,而向下滑动则显示div好像被推到页面上……您首先看到div的底部.

I want a "push" effect, where the slidedown instead reveals as though the div is being pushed onto the page ... where you first see the bottom of the div.

如何使用JQuery做到这一点?

How can I do this with JQuery?

更新:

这不是一个很好的例子,但确实显示了推送效果我试图实现的效果与滑动"效果相对应.

This isn't a great example, but it does show a push effect that I'm trying to accomplish vs a "slide" effect.

推荐答案

您可以使用jQuery的animate()方法.

You can use jQuery's animate() method.

$("div").css({top:0}).animate({top:500},{duration: 50});

这会将您的div初始设置为top:0,并在0.5秒的时间内将其设置为top:500.

This will set your div initially at top:0 and animate it to top:500 over a duration of 0.5 seconds.

这篇关于jQuery:如何执行“推送"操作滑动,而不是向上滑动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:30