开发者

div slide effect

i need to slide a div down and then up on an event, how can i do 开发者_开发问答this in java script


Update I created this demo for you :)

You can do that easily with slideToggle() function of JQuery:

<div id="hello">Hello World</div>
<a href="#" id="link">Toggle Div</a>

JQuery:

$(function(){
    $('#link').click(function(){
      $('#hello').slideToggle();
      return false;
    })
});


I would recommend that you check out jQuery/UI/Effects/Slide.


Highly recommend look at what JQuery or another javascript library does, (maybe even AJAX control toolkit for .NET, which has JS components) and examine the JS file, and replicate the feature yourself...

I will say it probably isn't that easy to replicate yourself, meaning that the logic is pretty complex.

HTH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜