Topic: Slight bug in toggle visual_effect...

Note: I'm using Rails v2.3.2,

I've been playing around with link_to_function and visual_effect recently, and had some problems.  I had the following link_to_function line in my view:

link_to_function("show more", visual_effect(:toggle_blind, :info, :duration=>0.5), :id => "more_link")
<div id="info">Some informative content here</div>

Then in an external stylesheet I had the info hidden by default like so:
#info { display:none; }

This did not work.  When the "show more" link was clicked, nothing happened.

On a whim, I took out the style from the external stylesheet and embedded it inline with the div like so:

<div id="info" style="display:none;">Some informative content here</div>

And presto!  A working "show more" link with the toggle_blind functionality working.  Is this a bug, or just some sort of unspoken convention?

I hope this saves others the headache I got.

Re: Slight bug in toggle visual_effect...

Just a guess here, but did you make sure to include the external stylesheet through a stylesheet_link_tag or similar?

Last edited by NoJ (2009-04-20 03:21:12)

Lead Developer of the WebNames Project and the wnrp:// protocol handler
http://we.bnam.es
wnrp://twitter.com

Re: Slight bug in toggle visual_effect...

The external stylesheet was included, and the info div even showed up as hidden.  The effect would simply not work until I included the style in-line.

Re: Slight bug in toggle visual_effect...

Thanks for the info DRV, I'm experiencing the same bug. Does anyone know if there's a way around using inline css?

Re: Slight bug in toggle visual_effect...

Pretty sure I had the exact same problem a few months ago... I had no idea myself what was going on.  I too would love to get some answers on this