Results 1 to 7 of 7

Thread: Style Sheet Switcher Question

  1. #1
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Style Sheet Switcher Question

    1) Style Sheet Switcher (v1.1)

    2) http://www.dynamicdrive.com/dynamici...etswitcher.htm

    3) Describe problem:

    I have 5 buttons:

    One makes the font bigger
    One makes the font smaller
    One makes the font return to default
    One makes the font green
    One makes the font return to default

    -

    If I make the font big and then press green, it makes the font green but at the default size...?

    Please could someone help me combat this?

    Kindest Regards,

    Rob

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Inside the CSS for making the font green, does it contain any rules that may cause the text to be resized to its default size? A link to the problem page might help.
    DD Admin

  3. #3
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I deleted the code I am afraid, I decided not to go down this route. Thanks for enquiring though !

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"
    Jeremy | jfein.net

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    For anyone else who has a similar question, here's how (following the post by ddadmin):

    1. Follow the basic ideas in the first post.
    2. Include ONLY properties in each css file that relate to the specific change required. This way switching to "green" will change the settings for color, but the old settings for size should remain. Then changing the size will update only the size, and the new green color will remain.
    I think this should work smoothly, but you should check in several browsers to be sure.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Not really. The way the style switcher works is that there is one default stylesheet that's always active and one or more alternates that all start out disabled. Each time the function runs it disables all but 0 or 1 of the alternates. So when switching to green you will have whatever font-size is in the default unless overridden in green, in which case you will have that. You will never have the font-size defined in any of the other alternates.

    The script would need a rewrite (probably fairly major) to allow for various alternates to be enabled at once. If so, what you say djr33 could work.

    However, if the font-size for the entire page is simply based upon the inherited percent font-size of the body element (a good practice anyway in most cases), a cookie could be setup just for that and it could be handled via a direct command along the lines of:

    Code:
    document.body.style.fontSize = '90%';
    That way color and font-size changes could then both be saved and be independent of each other.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by jscheuer1 View Post
    The script would need a rewrite (probably fairly major) to allow for various alternates to be enabled at once.
    Tons of scripts on DD need a major rewrite - half of them can be done with maybe 20 lines of code, including this one.
    Jeremy | jfein.net

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
  •