i need to slide a div down and then up on an event, how can i do this in java script
but i want to use it simply by javascript
vakas
2010-04-17 18:31:13
There is no simple way to do it without using a library like jQuery. Using jQuery will actually make things very simple whereas rolling your own code to do this would be very complex in comparison.
Andrew Hare
2010-04-17 18:34:48
@Andrew - I agree with your answer, but worth noting for slide up/down he doesn't need jQuery UI, just jQuery core will do.
Nick Craver
2010-04-17 18:35:59
+3
A:
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;
})
});
Sarfraz
2010-04-17 18:30:32
borother sorry to say, infact i have never used jquery before, do i need some spcial library to add,or any thing special else?
vakas
2010-04-17 18:48:32
@vakas: yes brother, you need to download the jquery from here http://jquery.com/ and include in your page.
Sarfraz
2010-04-17 18:51:07
i have added this<script type="text/javascript" src="JavaScript\jquery.js"> $(function(){ alert('hi'); $('#link').click(function(){ $('#hello').slideToggle(); return false; })}); </script> but nt wrking
vakas
2010-04-17 20:06:46
@vakas: see the code of the example demo link i posted in my answer, you can use like that.
Sarfraz
2010-04-17 20:13:21
thanx brother its wrking now, can u also plz tell me any method to shake the page, i want to prompt the user,dat something has happend.
vakas
2010-04-18 05:57:48
A:
Hey,
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.
Brian
2010-04-17 18:33:11