<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A simple div slide down JS script</title>
	<atom:link href="http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/</link>
	<description>A do-it yourself blog</description>
	<lastBuildDate>Mon, 23 Apr 2012 20:30:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Web Design Sydney</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-32396</link>
		<dc:creator>Web Design Sydney</dc:creator>
		<pubDate>Wed, 07 Dec 2011 12:37:20 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-32396</guid>
		<description>Thanks for the code. Best !</description>
		<content:encoded><![CDATA[<p>Thanks for the code. Best !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gene</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-2220</link>
		<dc:creator>Gene</dc:creator>
		<pubDate>Mon, 19 Apr 2010 15:05:37 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-2220</guid>
		<description>Is it possible to use this script in a &quot;vertical&quot; drop-down menu? I just want my menu to slide down instead of sliding over. It just takes up too much space. Sorry, I am a beginner at javascript and can&#039;t seem to grasp the CSS portion of it all, after already creating a code for the styling. I just want to add a simple function for a CSS vertical drop-down menu that is both easy to use and to understand.</description>
		<content:encoded><![CDATA[<p>Is it possible to use this script in a &#8220;vertical&#8221; drop-down menu? I just want my menu to slide down instead of sliding over. It just takes up too much space. Sorry, I am a beginner at javascript and can&#8217;t seem to grasp the CSS portion of it all, after already creating a code for the styling. I just want to add a simple function for a CSS vertical drop-down menu that is both easy to use and to understand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-1924</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Thu, 11 Feb 2010 18:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-1924</guid>
		<description>Hey Christophe, thank you  very much for your tips. I&#039;ve already solved the problem with some other solution. 

Nevertheless there is one question left :)


Is there any way to make the content of the div to slide down synchronously with the div? 

here is the way I&#039;ve optimized the script for my needs: 

It&#039;s certainly far away from being perfect :P I am very new to Javascript, but trying to do my best.

function doSlide(id,id2,id3,id4,id5,id6){
	timeToSlide = 120; // in milliseconds
	obj = document.getElementById(id);
	obj2 = document.getElementById(id2);
	obj3 = document.getElementById(id3);
	obj4 = document.getElementById(id4);
	obj5 = document.getElementById(id5);
	obj6 = document.getElementById(id6);

	
	if(obj.style.display == &quot;block&quot;){
	
	slideUp(obj,Math.ceil(obj.offsetHeight/timeToSlide),obj.offsetHeight);
	
	} else {
	
		obj2.style.display = &quot;none&quot;;
		obj3.style.display = &quot;none&quot;;
		obj4.style.display = &quot;none&quot;;
		obj5.style.display = &quot;none&quot;;
		obj6.style.display = &quot;none&quot;;
		obj.style.display = &quot;block&quot;;
		obj.style.visibility = &quot;visialbe&quot;;
		height = obj.offsetHeight;
		obj.style.height=&quot;0px&quot;;
		pxPerLoop = height/timeToSlide;
		slideDown(obj,0,height,Math.ceil(height/timeToSlide));
	
	}
}


function slideDown(obj,offset,full,px){
if(offset  0){
		obj.style.height = obj.offsetHeight-px+&quot;px&quot;;
		setTimeout((function(){slideUp(obj,px,full);}),1);
	} else {
		obj.style.height=full+&quot;px&quot;; // we reset the height if we were to slide it back down
		obj.style.display = &#039;none&#039;;
	}
}


Big thanks in advance.

Andrew</description>
		<content:encoded><![CDATA[<p>Hey Christophe, thank you  very much for your tips. I&#8217;ve already solved the problem with some other solution. </p>
<p>Nevertheless there is one question left <img src='http://djpate.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Is there any way to make the content of the div to slide down synchronously with the div? </p>
<p>here is the way I&#8217;ve optimized the script for my needs: </p>
<p>It&#8217;s certainly far away from being perfect <img src='http://djpate.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  I am very new to Javascript, but trying to do my best.</p>
<p>function doSlide(id,id2,id3,id4,id5,id6){<br />
	timeToSlide = 120; // in milliseconds<br />
	obj = document.getElementById(id);<br />
	obj2 = document.getElementById(id2);<br />
	obj3 = document.getElementById(id3);<br />
	obj4 = document.getElementById(id4);<br />
	obj5 = document.getElementById(id5);<br />
	obj6 = document.getElementById(id6);</p>
<p>	if(obj.style.display == &#8220;block&#8221;){</p>
<p>	slideUp(obj,Math.ceil(obj.offsetHeight/timeToSlide),obj.offsetHeight);</p>
<p>	} else {</p>
<p>		obj2.style.display = &#8220;none&#8221;;<br />
		obj3.style.display = &#8220;none&#8221;;<br />
		obj4.style.display = &#8220;none&#8221;;<br />
		obj5.style.display = &#8220;none&#8221;;<br />
		obj6.style.display = &#8220;none&#8221;;<br />
		obj.style.display = &#8220;block&#8221;;<br />
		obj.style.visibility = &#8220;visialbe&#8221;;<br />
		height = obj.offsetHeight;<br />
		obj.style.height=&#8221;0px&#8221;;<br />
		pxPerLoop = height/timeToSlide;<br />
		slideDown(obj,0,height,Math.ceil(height/timeToSlide));</p>
<p>	}<br />
}</p>
<p>function slideDown(obj,offset,full,px){<br />
if(offset  0){<br />
		obj.style.height = obj.offsetHeight-px+&#8221;px&#8221;;<br />
		setTimeout((function(){slideUp(obj,px,full);}),1);<br />
	} else {<br />
		obj.style.height=full+&#8221;px&#8221;; // we reset the height if we were to slide it back down<br />
		obj.style.display = &#8216;none&#8217;;<br />
	}<br />
}</p>
<p>Big thanks in advance.</p>
<p>Andrew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Verbinnen</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-1921</link>
		<dc:creator>Christophe Verbinnen</dc:creator>
		<pubDate>Wed, 10 Feb 2010 13:30:10 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-1921</guid>
		<description>1) try to alert(obj.style.display) in doSlide after obj = ...;
2) you&#039;ll have to add something like
if(currentDiv != &#039;&#039;){
 document.getElement.byId(currentDiv).display = &#039;none&#039;;
}
var currentDiv = id</description>
		<content:encoded><![CDATA[<p>1) try to alert(obj.style.display) in doSlide after obj = &#8230;;<br />
2) you&#8217;ll have to add something like<br />
if(currentDiv != &#8221;){<br />
 document.getElement.byId(currentDiv).display = &#8216;none&#8217;;<br />
}<br />
var currentDiv = id</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-1920</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Wed, 10 Feb 2010 13:23:18 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-1920</guid>
		<description>Hello Christophe, 

it\&#039;s brillian scipt u\&#039;ve made there.

Nevertheless I have a couple of questions, and it would be great, if you could help me out.

1) I have a strange bug: when I load the page for the first time (or just refresh it) and then  click on the button to perform the slide script for a hidden (display:none) div, then nothing happens untill I press the button for the second time. After I\&#039;ve \&quot;doubleclicked\&quot; the button once, it works flawlessly untill I reload the page.  This problem doesn\&#039;t occur if the div which is supposed to slide has no \&quot;display:none\&quot; tag set.

2) I would like to have multiple divs which slide down from the same position when u press different buttons: For Example: I have buttons \&quot;Contact\&quot;, \&quot;Products\&quot; and \&quot;Materials\&quot;
So when I press \&quot;Contact\&quot; a div \&quot;Contactdiv\&quot; should slide down. Then if I press \&quot;Products\&quot; the div \&quot;Contactdiv\&quot; should (disappear) and the  div \&quot;Productsdiv\&quot; shoud slidedown at its position instead. At the moment it works in the way, that all the divs just slidedown one after another  in a vertical line. So I have to force them to (disappear) manualy, but pressing the assigned buttons again.

Big thanks in advance.

Andrew</description>
		<content:encoded><![CDATA[<p>Hello Christophe, </p>
<p>it\&#8217;s brillian scipt u\&#8217;ve made there.</p>
<p>Nevertheless I have a couple of questions, and it would be great, if you could help me out.</p>
<p>1) I have a strange bug: when I load the page for the first time (or just refresh it) and then  click on the button to perform the slide script for a hidden (display:none) div, then nothing happens untill I press the button for the second time. After I\&#8217;ve \&quot;doubleclicked\&quot; the button once, it works flawlessly untill I reload the page.  This problem doesn\&#8217;t occur if the div which is supposed to slide has no \&quot;display:none\&quot; tag set.</p>
<p>2) I would like to have multiple divs which slide down from the same position when u press different buttons: For Example: I have buttons \&quot;Contact\&quot;, \&quot;Products\&quot; and \&quot;Materials\&quot;<br />
So when I press \&quot;Contact\&quot; a div \&quot;Contactdiv\&quot; should slide down. Then if I press \&quot;Products\&quot; the div \&quot;Contactdiv\&quot; should (disappear) and the  div \&quot;Productsdiv\&quot; shoud slidedown at its position instead. At the moment it works in the way, that all the divs just slidedown one after another  in a vertical line. So I have to force them to (disappear) manualy, but pressing the assigned buttons again.</p>
<p>Big thanks in advance.</p>
<p>Andrew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Webtasarım</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-1702</link>
		<dc:creator>Webtasarım</dc:creator>
		<pubDate>Fri, 15 Jan 2010 02:07:35 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-1702</guid>
		<description>Thanks for the script.</description>
		<content:encoded><![CDATA[<p>Thanks for the script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Verbinnen</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-667</link>
		<dc:creator>Christophe Verbinnen</dc:creator>
		<pubDate>Wed, 07 Oct 2009 17:44:43 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-667</guid>
		<description>&lt;a href=&quot;#comment-665&quot; rel=&quot;nofollow&quot;&gt;@Vidha&lt;/a&gt; 
Hello vidha,

you don&#039;t have to do anything particular for multiple instance.

Just call up the function with the div id in as argument and it will slide only that particular div.

You can use it with a &quot;virtually&quot; unlimited number of divs...</description>
		<content:encoded><![CDATA[<p><a href="#comment-665" rel="nofollow">@Vidha</a><br />
Hello vidha,</p>
<p>you don&#8217;t have to do anything particular for multiple instance.</p>
<p>Just call up the function with the div id in as argument and it will slide only that particular div.</p>
<p>You can use it with a &#8220;virtually&#8221; unlimited number of divs&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vidha</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-665</link>
		<dc:creator>Vidha</dc:creator>
		<pubDate>Wed, 07 Oct 2009 17:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-665</guid>
		<description>Hi Chris,
Thanks for the script, how would multiple instances work?</description>
		<content:encoded><![CDATA[<p>Hi Chris,<br />
Thanks for the script, how would multiple instances work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Verbinnen</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-619</link>
		<dc:creator>Christophe Verbinnen</dc:creator>
		<pubDate>Fri, 02 Oct 2009 22:37:33 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-619</guid>
		<description>&lt;blockquote cite=&quot;#commentbody-617&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-617&quot; rel=&quot;nofollow&quot;&gt;Tom&lt;/a&gt; :&lt;/strong&gt;
&lt;p&gt;Thanks for sharing this very useful and minimal script!&lt;/p&gt;
&lt;p&gt;I would love to get my hands on the script that slides back, but the link is broken. Any chance you still have that script?&lt;/p&gt;
&lt;/blockquote&gt;
It&#039;s done :)</description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-617"><p>
<strong><a href="#comment-617" rel="nofollow">Tom</a> :</strong></p>
<p>Thanks for sharing this very useful and minimal script!</p>
<p>I would love to get my hands on the script that slides back, but the link is broken. Any chance you still have that script?</p>
</blockquote>
<p>It&#8217;s done <img src='http://djpate.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://djpate.com/2009/02/22/a-simple-div-slide-down-js-script/comment-page-1/#comment-617</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://djpate.com/?p=5#comment-617</guid>
		<description>Thanks for sharing this very useful and minimal script!

I would love to get my hands on the script that slides back, but the link is broken. Any chance you still have that script?</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this very useful and minimal script!</p>
<p>I would love to get my hands on the script that slides back, but the link is broken. Any chance you still have that script?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

