SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can i make a font-size menu?

    Hey,

    Could somebody tell me how to make a little menu where the user can set te font size? I wanted three a's like this: A A A. When you click on it, the font-size on the website will change. I think you can do this with javascript, but i don't know any javascript .

    Thanks in advance!

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You might like to look around for Stylesheet Switching

    The following links may be helpful:
    - http://www.thesitewizard.com/javascr...e-sheets.shtml
    - http://webdevcodex.com/how-to-switch...-using-jquery/
    - http://www.alistapart.com/articles/alternate/

    The basic premise is that you use "Alternate stylesheets". You can activate these stylesheets with JavaScript in which you can override things like font size.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AussieJohn View Post
    You might like to look around for Stylesheet Switching

    The following links may be helpful:
    - http://www.thesitewizard.com/javascr...e-sheets.shtml
    - http://webdevcodex.com/how-to-switch...-using-jquery/
    - http://www.alistapart.com/articles/alternate/

    The basic premise is that you use "Alternate stylesheets". You can activate these stylesheets with JavaScript in which you can override things like font size.
    Okay thanks! Can i do this with jquery too?

  4. #4
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by matsvanrooij View Post
    Okay thanks! Can i do this with jquery too?
    Of course Just check the second link AssieJohn posted, or this link: http://www.cssnewbie.com/simple-jque...heet-switcher/

  5. #5
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made the little menu. Thanks a lot!

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by matsvanrooij View Post
    Could somebody tell me how to make a little menu where the user can set te font size?
    I should add that it's more beneficial to teach the user to use the tools that come with their web browser to set their preferred font size, where they hold down the Ctrl key and use + or - to make things bigger or smaller, and Ctrl-0 to reset back to the default.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    I should add that it's more beneficial to teach the user to use the tools that come with their web browser to set their preferred font size, where they hold down the Ctrl key and use + or - to make things bigger or smaller, and Ctrl-0 to reset back to the default.
    If only there was a JS API that could hook in to the browsers' native functionality.
    </wishful-thinking>
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


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
  •