Change text opacity separately with backGround

Discussion in 'JavaScript' started by So1, Mar 25, 2008.

  1. #1
    I tryed scriptaculous Effects - background changing... jQuery - the same effect. Tryed to make this myself... the same result. Maybe somebody already had been do it?

    beforehand, sorry for my English :D
     
    So1, Mar 25, 2008 IP
  2. Morishani

    Morishani Peon

    Messages:
    239
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, just create a child element with the text, like this :

    
    <div class="background">
     <div class="text_effect">
     text here
     </div>
    </div>
    
    HTML:
    and then apply the effect on the child element (div class="text_effect")
     
    Morishani, Mar 25, 2008 IP
  3. So1

    So1 Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    at first i've thought that it'll work but

    css:
    .backgr {background:#FFAAEE;}

    HTML & JS:
    <div class="backgr">
    <div id="1" onClick="this.style.filter='alpha(opacity=50)';" class="text_effect"> <img src="http://forums.digitalpoint.com/images/buttons/newthread.gif" onClick="this.style.filter='alpha(opacity=50)';"> text here </div>
    </div>

    when you click at image opacity of image changes, but if you click inside the "div" - opacity don't changes. not for image, not for text. The same if tou click at the button.
    Strangely enough, this code dont work =(
    Maybe i doing something wrong? =(
     
    So1, Mar 25, 2008 IP
  4. Morishani

    Morishani Peon

    Messages:
    239
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that's wierd, try to give the div some width, maybe it will help.
     
    Morishani, Mar 25, 2008 IP
  5. So1

    So1 Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    HA! If i type code as above, it's not work. If i use <table><tr><td></td></table> inside the DIV and changing opacity of table like this: <table onClick="this.style.filter='alpha(opacity=50)';"><tr><td>some content</td></tr></table> it works :D and div color not changes. HURAAAAY!

    Once again, sorry for my poor english :D
     
    So1, Mar 26, 2008 IP