CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    352

    Lightbulb JavaScript: Making color lighter

    HTML Code:
    <label for="biz_name">Bussines name</label>
    Color and all other properties for label element have been set in external CSS file.
    Minimizing markup!

    I need a JS script, which will:
    a) get activated / triggered when label element is being hovered.
    b) obtain a color of label element.
    c) make that color lighter, of that label element (no matter what color is in question)

    Color is hex!
    Ipsens

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: JavaScript: Making color lighter

    What's so hard about this? All you will be doing is using the onmouseover and onmouseout events mixed with a custom JavaScript function. In that function, use parseInt(x, 16) to work with the hexadecimal numbers.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2006
    Posts
    352

    Re: JavaScript: Making color lighter

    Problem is that I don't know, "how much" should I add or subtract from current color, to make it lighter
    Ipsens

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: JavaScript: Making color lighter

    Any amount you add will make it lighter. Just play around with the amount until you get results you like.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jan 2006
    Posts
    352

    Re: JavaScript: Making color lighter

    Ok, thanks!
    Ipsens

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured