开发者

div slide effect

开发者 https://www.devze.com 2022-12-27 01:05 出处:网络
i need to slide a div down and then up on an event, how can i do 开发者_开发问答this in java scriptUpdate

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

精彩评论

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

关注公众号