<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marilyn Burgess &#187; Fx.Slide</title>
	<atom:link href="http://marilynburgess.com/tag/fx-slide/feed/" rel="self" type="application/rss+xml" />
	<link>http://marilynburgess.com</link>
	<description></description>
	<lastBuildDate>Mon, 29 Aug 2011 16:33:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Maintaining Dynamic Height on a Fx.Slide element with Mootools</title>
		<link>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/</link>
		<comments>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:04:35 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dynamic height]]></category>
		<category><![CDATA[Fx.Slide]]></category>
		<category><![CDATA[mooTools]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=475</guid>
		<description><![CDATA[List Central uses mooTools for it&#8217;s JavaScript framework. I love it! It makes developing in JavaScript a pleasure, with increased reliability, and nifty eye candy to play with. I recently started using FX.Slide in the next iteration of the List Central interface. It lets the user open and close &#8220;sliders&#8221; (div&#8217;s with content in them) [...]]]></description>
			<content:encoded><![CDATA[<p>List Central uses <a href="http://mootools.net/">mooTools</a> for it&#8217;s JavaScript framework. I love it! It makes developing in JavaScript a pleasure, with increased reliability, and nifty eye candy to play with.  </p>
<p>I recently started using FX.Slide in the next iteration of the List Central interface. It lets the user open and close &#8220;sliders&#8221; (div&#8217;s with content in them) as they want them. Check out the < a href="http://demos.mootools.net/Fx.Slide">mooTools demo to see FX.Slide in action</a>.</p>
<p>I had one little problem with Fx.Slide though. The problem was that I wanted to be able to dynamically add content to an Fx.Slide, changing the height of the slider div after it has been opened. To my dismay, the implementation of Fx.Slide set the height of the div to specific numbers in pixel to achieve the vertical slider effect. This means that any content I added to the bottom of the div after it was opened would not be shown. In order for the height of the slider div to remain dynamic, I needed the height to be set to &#8220;auto&#8221;, not a specific number.</p>
<p>I had to figure out a way to maintain the the div&#8217;s ability to change in height while still using FX.Slide. I did some fiddling in mooTools source to try to achieve the effect I desired. I changed where FX.Slide set the height of the div to &#8220;auto&#8221;.  After trying it out, I was astonished that it worked! I had moved on to some other development when I realized that my change to the mooTools source brock the fluid motion of my slider. It now opened all choppy and jumpy. It was no longer pleasing to the eye. I had to put the source back the way I found it. I may have learned some about the inner workings of mooTools though the process, but really, messing with the framework&#8217;s source is a path to trouble. </p>
<p>As with many problems, this one&#8217;s solution didn&#8217;t come to me until I put the problem away for a while, and worked on other things. The solution then came to me, and like many other solutions, it seemed so simple, once I knew it.</p>
<p>The trick to maintain dynamic height on a Fx.Slide is to add an onComplete function on to the slider that sets the height of the slider to &#8220;auto&#8221; if the slider is open, like this:</p>
<pre class="brush: javascript">

var formSlide = new Fx.Slide(&#039;FormSlider&#039;, {
        onComplete: function(){
            if(this.wrapper.getStyle(&#039;height&#039;) != &quot;0px&quot;){
                // Check if the slider is open
                this.wrapper.setStyle(&#039;height&#039;, &#039;auto&#039;);
            }
        }
    }).hide();
</pre>
<p>That&#8217;s it! It works like a charm now, just as I want it to. So much trouble, for such a simple solution!</p>
<p>I expect that this solution would work the same on the width for horizontal FX.Slide&#8217;s, though I haven&#8217;t tested it. </p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2010/01/put-a-handle-on-mootools-drag-move/" title="Put a handle on mooTools Drag.Move">Put a handle on mooTools Drag.Move</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

