SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    text-increase on web site with Javascript

    I'd like to integrate a text increase/decrease feature on my html pages. I researched this and found that the current crop of JS code require the inline use of "font-size:12px" or something similar. My pages all have the font sizes in an external CSS file.

    I'm going to use this functionality in an app for the iPhone and Android platforms using HTML, CSS, and JS. I'll abandon it, though, if I have to add the font-size to all my paragraphs across hundreds of pages.

    Is there a way to add an external JS file that works on pages where the font size is determined by a CSS file? I want it to work just on my <p> text, so it doesn't have to be elaborate. No cookies on these devices, so it will have to work page by page.

    Thanks for any answers.

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Here is one of many code examples on the web:
    Controlling Font Size With Javascript

  3. #3
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I found an answer that works:
    Dynamic Drive DHTML Scripts- Document Text Sizer

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    I found an answer that works
    My answer that works is to use the built-in web browser text resize features.
    If you don't want to find them in the View menu, you can use Ctrl-minus and Ctrl-plus as well as Ctrl-zero to set back to the default size.

    Other web browser features that are strangely wanted to be done via the web page, are to print the page, or to save a page as a bookmark.
    Why throw so much effort in to duplicating what is already easily available? I just don't get it.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is for the Android platform, which doesn't have the function built in to an app. There's a method to my madness!

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    This is for the Android platform, which doesn't have the function built in to an app. There's a method to my madness!
    If I had an Android device, would the app called Spare Parts be of any use where a web site doesn't provide the ability?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I've created a hymnbook app. I'm aware that many people who love hymns are older and have poorer eyesight. It is true that my calculator app will be a good fit, because some older people in the sport will use it.

    The apps I'm creating for the Android and iPhone will accept Javascript, since I'm using HTML and CSS to create the pages.

    I need to mention that I've tested page after page of scripts before I found one that worked. We can consider this thread closed.


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
  •