Forum: Ruby on Rails Change stylesheets asynchronously

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John W. (Guest)
on 2006-06-09 17:30
I have my default "scaffold.css" that loads when the page loads, however
I would like to be able to dynamically change the CSS sheet by clicking
a link.  I tried wrapping the stylesheet like below:

<head>
  <div id="css-theme">
    <link rel="stylesheet" href="/stylesheets/scaffold.css"
type="text/css" media="screen" />
  </div>
</head>

and then using link_to_remote to update the "css-theme" div, but that
did work exactly as I was expecting. Can someone give me some ideas as
to how I can do this?  I wouldn't think it would be too hard.
BB (Guest)
on 2006-06-11 08:47
This is a pretty widely used method.

Works great too.

http://www.alistapart.com/articles/alternate/
This topic is locked and can not be replied to.