Hi, I want to hide some of my html in my view before toggling. In my css I tried setting the display:none; but then when I would run my toggle function it wouldn''t toggle. Is there an easy solution out there besides having to render javascript everytime to hide this html before toggling it? -- Posted via http://www.ruby-forum.com/.
Chase Midler wrote:> Hi, I want to hide some of my html in my view before toggling. In my > css I tried setting the display:none; but then when I would run my > toggle function it wouldn''t toggle. Is there an easy solution out there > besides having to render javascript everytime to hide this html before > toggling it?are you looking for a solution to your first question? hidding views or do you want a solution without rendering javascript? -- Posted via http://www.ruby-forum.com/.
I want to know how I can have my html text not display when a page loads, but still works with toggle. I.E. when using the css display:none; toggle does not work, but the html is hidden. When I do not use the css display:none; toggle does work, but the html is always present when I first load the page. -- Posted via http://www.ruby-forum.com/.
Chase Midler wrote:> I want to know how I can have my html text not display when a page > loads, but still works with toggle. I.E. when using the css > display:none; toggle does not work, but the html is hidden. When I do > not use the css display:none; toggle does work, but the html is always > present when I first load the page.Make sure you are loading prototype js libraries for this page -- <%= javascript_include_tag :defaults %> this example assumes you view has an image which when clicked displays a hidden content and hides it when click again. view ----- <%= image_tag("blah", :onclick=>"$(''abc'').toggle();")%> <div id="abc" > ...hidden content... </div> css ---- #abc { display:none; } -- Posted via http://www.ruby-forum.com/.
Rails List wrote:> Make sure you are loading prototype js libraries for this page -- > <%= javascript_include_tag :defaults %> > > this example assumes you view has an image which when clicked displays a > hidden content and hides it when click again. > > view > ----- > > <%= image_tag("blah", :onclick=>"$(''abc'').toggle();")%> > > <div id="abc" > > > ...hidden content... > > </div> > > css > ---- > #abc { > display:none; > }Okay, so I have the javascript include tag for defaults. I do the following in my view: <%= link_to_function("More") do |page| page.Effect.toggle("more_nav") end%> <div id="more_nav"> <ul> <%more_links.each do |text,link| -%> <li style ="display:none;"><%= link_to text, link %></li> <% end -%> </ul> </div> With this code running toggle does not work, the "more_nav" div does not display. If I take out style ="display:none;" then toggle works, but the more_nav html is displayed on the page when it loads. -- Posted via http://www.ruby-forum.com/.
Possibly Parallel Threads
- RJS support "toggle" effect?
- padawan seeks advice from jedi masters to create toggle box via ajax/rjs before slitting wrists with ruby powered light-saber.
- Conditional toggle button
- One content at a time - Effect.toggle
- Weird stylesheet_link_tag issue after moving servers