On Thu, Jul 16, 2009 at 8:30 AM, Michael Schuerig<[email protected]> wrote: > > On Thursday 16 July 2009, Patrick Doyle wrote: >> Are you saying that its possible to globally change the style rules >> programatically somehow? > > Yes: > > <html> > <head> > ... > <script type="text/javascript" src="javascripts/prototype.js" /> > <script type="text/javascript" src="javascripts/switcher.js" /> > </head> > <body> > ... > </body> > </html> > > switcher.js: Here the magic goes. Check window.location.href or the > cookie specify any particular style. If they do, change the class of the > BODY element > > Element.addClassName(document.body, 'large-font'); > Oh, I see...
>> What is the >> benefit of doing that as compare to the way I've seen it done (on >> another, PHP, project) of loading one stylesheet or another at the >> time the page is served? > > You can apply changes dynamically without a round-trip to the server. If > you currently have pages that are static, but for the style-switching, > you can make them completely static, i.e., they can be served by the web > server without any processing by Rails. Nice! Thanks a lot. I wouldn't have thought of that approach myself, but it's the right way to do this. --wpd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

