Topic: Disabling Javascript

Basically I have a div set to be hidden (display:none) and I would like to use the toggle_blind effect on my site to show the information only if the user is interested. Where I am running in to a problem is when I disable javascript I would like the div to be displayed and not hidden. My question is whether anyone has any recommendations on the best way to achieve this?

In addition, I have been able to find a ton of information about adding great Ajax effects easily with Rails, but literally no information about about how to handle things when javascript is turned off. It almost seems like it isn't on anyones mind. Does anyone have any resources that I maybe haven't come across yet or am I really the only one who is concerned about this?

Re: Disabling Javascript

You could hide the div using JavaScript when the page loads. However, this will likely cause the element to appear visible at the very beginning before the javascript file has loaded. I'm not sure of a way around that (I'm not a Javascript guy).

Anyway, the Unobtrusive Javascript Plugin seems to support fully degradable Javascript. I haven't seen much else on the subject.

Railscasts - Free Ruby on Rails Screencasts

Re: Disabling Javascript

Thanks for the quick response! I will take a look at that plugin.

I am still amazed at the lack of information out there on degradable Javascript.

I appreciate your help.

Re: Disabling Javascript

What you should do is hide the div with js instead of CSS.  That way users with js disabled will still be able to see it.

<div id="hide_this">&nbsp</div>
<%= javascript_tag(visual_effect :hide, 'hide_this', :duration => 0) %>

I didn't test that code but it's about right.