SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Attaching stylesheet so user can change the style?

    How is this done, where you may have multiple stylesheets for the user to try, and when they click on one or the other, it changes how the page looks based on your content in a particular style sheet.

    Like if i Have

    <a href="#" title="blue">Blue</a>

    If that is clicked, then my blue.css style sheet would get applied to the site.

    Thanks
    Bryan

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may want to take a look at this article at A List Apart (http://www.alistapart.com/stories/alternate/).

    I'm using it on my blog and it works fine and simply enough.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Edinburgh, Scotland
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out this article on the A List Apart site.

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Edinburgh, Scotland
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm - beat me to the very one by a minute!

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Also http://www.alistapart.com/stories/phpswitch/ if you want a PHP-based switcher instead of a Javascript-based one. Both have their benefits and drawbacks.

  6. #6
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much.

  7. #7
    Ensure you finish what you sta bronze trophy John Colby's Avatar
    Join Date
    Aug 2003
    Location
    University of Central England, U.K.
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bryan

    I have implemented stylesheet switching (and text size alteration) for accessibility on http://www.cie.uce.ac.uk/essential/accessibility.html

    If youneed it I'll zip up the site and mail it to you. The whole thing is under test for accessibility functionality - hence it may change at short notice. Like as soon as I can get round to it!
    John
    No electrons were harmed during the creation, transmission
    or reading of this posting. However, many were excited and
    some may have enjoyed the experience.

  8. #8
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure. If its the same thing that I found on the alistapart website, then there is no need. If it is altered to be easier, sure zip it up and let me know.

    Thanks
    Bryan

  9. #9
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I attached them, works great in IE 6.0, except that once it gets past the bottom of my site, it stays the old color.

    Mozilla, on the other hand, doesn't recognize the script from alistapart at all.

    check it out and please tell me how it goes,

    http://www.btkdesigns.com/newbtk/index2.htm

    Thanks
    Bryan

    ---edit---

    actually I added enough celstial babble that it goes to the bottom of the screen.

  10. #10
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty sure the script from A List Apart works in Mozilla (Firebird, at least, because that's what I use, but it shouldn't be any different) - I use Firebird 99% of the time and my style switcher, as well as others like that at zeldman.com, works fine.

    Oh and I just tested it and the style switcher works in Firebird. I did have to wait for the whole page to finish loading before the style switcher started to work though.

  11. #11
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John Colby
    I have implemented stylesheet switching (and text size alteration) for accessibility on http://www.cie.uce.ac.uk/essential/accessibility.html
    Nice example

    Have you thought about having the link colours in the sample colour boxes set to the "text color"?

    Douglas
    Hello World

  12. #12
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh and I just tested it and the style switcher works in Firebird. I did have to wait for the whole page to finish loading before the style switcher started to work though.
    HUH! Weird how it works for you. It is the script from AlistApart but my mozilla and firebird don't like it.

    I know in mozilla you can go up to VIEW (i think) and choose the style from there. Firebird doesn't have anything like that.

    I wonder why it works for you but not me?

    Thanks
    Bryan

  13. #13
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the one at Zeldman (which I can't find) better then alistaparts?

    it has to wait because its changing all the images I have set for backgrounds. The main header is the big one, about 40k

  14. #14
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The one at Zeldman should be the same as the one at A List Apart. You could always check his HTML source to see his JS, but I don't think it should be any different.

    I'm using a Firebird nightly build with a built-in style switcher, and that works, as well as the one on your site. But like I said you have to wait until most of the page is loaded - did you do that?

  15. #15
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did I make it to wait till most of the page is loaded?

    Not intentionally. I have never done a style switcher until last night. I just followed the rules from alistaparts website. I have one prefered and then the 4 alternate styles. I am not sure what you are asking.

    Thanks

  16. #16
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you misunderstood my question. I meant to ask whether you waited for most of the page to load before you tried switching styles, not that you forced it to wait till most of the page is loaded.

    Anyhow, I've confirmed that it works in Firebird once again. When you say it doesn't work, how exactly doesn't it work?

  17. #17
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Europe
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use Firebird as well. It works with the browsers built-in style switcher, but not with the provided links. I guess the JavaScript doesn't work.

  18. #18
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's mighty strange (the links work for me). If we could get more people to verify this (one way or the other), it would be good.

    I'd opened the JavaScript console to check, and there were no errors with the JavaScript.

  19. #19
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey redemption

    Yes, I am on a cable modem, so I would have to work very fast to click the link before the whole page loads. So when testing my personal site, I wait till it loads before trying to load a style.

    When I click on the link in Firebird and/or Mozilla, nothing happens. I click and nothing.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •