<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Bart G. Dev...: Script.aculo.us - Effect.Appear display: and background: solutions</title>
    <link>http://www.bartgdev.com/articles/2006/09/18/script-aculo-us-effect-appear-solution</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>&lt;b&gt;Dev&lt;/b&gt;eloping well &lt;b&gt;dev&lt;/b&gt;ised applications</description>
    <item>
      <title>Script.aculo.us - Effect.Appear display: and background: solutions</title>
      <description>&lt;p&gt;There’s bit of a bug with Effect.Appear and IE.  There’s a discussion open on it &lt;a href="http://wiki.script.aculo.us/scriptaculous/discuss/Effect.Appear"&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Basically there are 2 issues discussed with Effect.Appear:
&lt;ol&gt;
  &lt;li&gt;doesn’t work if the display: property is not set to ‘none‘&lt;/li&gt;
  &lt;li&gt;if the :background property is not set, the text is bolded while appearing, then switches to the chosen weight&lt;/li&gt;
&lt;/ol&gt;
&lt;/p&gt;

&lt;p&gt;The obvious remedy to both 1) and 2) is to set display: none; and background: #hex; before calling Effect.Appear.  The problem with 2) occurs when you’re background is an image.
&lt;/p&gt;

&lt;p&gt;For my use, I needed to repeatedly call Effect.Appear using the Rails &lt;span class="caps"&gt;AJAX&lt;/span&gt; method periodically_call_remote.  I’ve setup the following JavaScript function to handle 1) and 2).  It can be used as a one time call before calling Appear, or repeated calls as in &lt;a href="http://woman2womanwritingproject.com"&gt;my use&lt;/a&gt;.  See the quote fading in after a few seconds on the &lt;a href="http://woman2womanwritingproject.com"&gt;w2wwp&lt;/a&gt; implementation of my &lt;a href="http://rubyforge.org/projects/simplecms/"&gt;Simple &lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/a&gt; Rails app.
&lt;/p&gt;
&lt;pre&gt;
=&amp;gt; RHTML
  :complete =&amp;gt; "myAppear('myDiv', '#ccc')" 

=&amp;gt; JavaScript
  function myAppear( mydiv, bckgrd)
  { 
    el = document.getElementById(mydiv); 
    el.style.background = bckgrd; 
    el.style.display = 'none'; 
    new Effect.Appear(mydiv);
  }
&lt;/pre&gt;</description>
      <pubDate>Mon, 18 Sep 2006 10:57:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1a78dda4-9424-4a2f-a1f3-82161839577c</guid>
      <author>Bart</author>
      <link>http://www.bartgdev.com/articles/2006/09/18/script-aculo-us-effect-appear-solution</link>
      <category>Rails</category>
      <category>Web Dev</category>
      <category>css</category>
      <category>Script.aculo.us</category>
      <category>Effect.Appear</category>
    </item>
  </channel>
</rss>

