SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast lhatkins's Avatar
    Join Date
    Dec 2002
    Location
    Exeter, UK
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Font, sizes & Colours

    I've seen sites where you can change the Font Face, Size, forground and background colours on a site.

    Most that I've seen are using javascript, and the idea os this option I think is good, but I would like to know what others think.

    Is it a problem using so much javascript and is there other ways of doing this without javascript?

    Does it have any real use or is more a pain in the neck.

    We use this feature on our sensory site, I just wonder if its of any use?

    Personally I don't use these features, I use Supernova so its enlarged for me (thought this software is always crashing on me!).

    Any thoughts?
    Regards

    ---
    Lee

  2. #2
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mozilla and some of it's derivatives have alternate style switching built right into the browser. Other than that and JavaScript, the only way I can think of implementing it is with a preferences cookie set with a server-side language(would require cookies and a page reload.)
    TuitionFree — a free library for the self-taught
    Anode Says...Blogging For Your Pleasure

  3. #3
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are you referring to something like www.zeldman.com or www.alistapart.com?

    Here, Javascript is used to add functionality (let the user switch between stylesheets), in such a way that if Javascript is disabled it won't harm any functionality. The Javascript adds to the accessibility and is non-essential.

    If the javascript is done in such a way that it doesn't harm existing accessibility and if the browser doesn't support it, it won't mess anything up, then it is good.

    What happens if you use your site when Javascript is disabled?
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog · Twitter · Contact me
    Neon Javascript Framework · Jokes · Android stuff

  4. #4
    SitePoint Enthusiast lhatkins's Avatar
    Join Date
    Dec 2002
    Location
    Exeter, UK
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there, ya those examples are similar (though ours are not as good), to what we are using. if java script is disabled you get a message advising you that the fuction to change text size and fonts are not available.

    My question I guess what I'm asking is, if this feature is worth keeping and refining, just wonder if I should devote some time into cleaning the current script up or is it just a feature that no one uses anyway.
    Regards

    ---
    Lee

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    There are ways to build style switchers in PHP. Look here. This will help if you don't want to rely on javascript.

  6. #6
    SitePoint Enthusiast lhatkins's Avatar
    Join Date
    Dec 2002
    Location
    Exeter, UK
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    There are ways to build style switchers in PHP. Look here. This will help if you don't want to rely on javascript.
    Thats Great thanks, I'm not over joyed about javascript, I must admit, anything that required a "plug-in" to work gets a thumbs down in my book.
    Regards

    ---
    Lee

  7. #7
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't be against using Javascript to achieve this, because it is not something that affects the data itself - it is something that can be done client-side. I think using a server-side script would be slower, and would use extra bandwidth.

    As far as I can see, using PHP to change styles would also involve the reloading of a page, and therefore if the page contained dynamic data (such as the results of a query or form) that data may change.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog · Twitter · Contact me
    Neon Javascript Framework · Jokes · Android stuff

  8. #8
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Opera lets you change a page's styles, too. :-)

    Really, I don't know if I like ALA system, since the links to change the style are like a dead monkey without JavaScript enabled. I suppose that the PHP method in addition to the JS one will alleviate that, but it has its drawbacks too.

    Maybe there's a way to have the JS method as a default, and as a fall back, the browser would be sent to some Server-side script page that'd just set a cookie and redirected back to the original. All that needs doing from then on, would be for the server to change the Link HTTP header instead of messing around in workings of a page--still requires a reload, but you'd also not need to make all your pages dynamic for it to work. Don't know about browser support for the Link header, and in truth someone who's disabled JS would probably disable cookies too, so I don't know how workable it'd be, but it's an idea. :-)

    ~~Ian

  9. #9
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ian Glass
    Maybe there's a way to have the JS method as a default, and as a fall back, the browser would be sent to some Server-side script page that'd just set a cookie and redirected back to the original.
    i think that's what http://devedge.netscape.com does...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  10. #10
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Man, all the good ideas are taken! :-(

    Nah, their method requires JavaScript--just went through it. ;-)

    ~~Ian

  11. #11
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know little about javascript, but wouldn't it be possible to have something like:

    <a onclick="switchStylesheet('style1'); return false;" href="/switch.php">switch</a>

    Where switchStylesheet is a javascript function that changes the style, and switch.php is a script that changes some css then redirects you to the page you were at.

    I'm not sure if this is right, but I think onclick takes priority over a href attribute, so if someone has javascript enabled it changes the style dynamically, if not it acts as a normal link to switch.php


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
  •