Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Hovering and opacity

  • 31-05-2011 8:11am
    #1
    Registered Users, Registered Users 2 Posts: 1,501 ✭✭✭


    I have a problem i can't work out. I want to hover over one div and have two other divs revert to 40% opacity. I think my main problem is i don't know what the syntax is to write this. Below is the relevant code:

    HTML
    <div id="main">
    		<div id="nav_home">
    			<a href="#"><span><h1>D9</h1></span></a>
    		</div> <!--end of nav_home div-->
    		
    		<div id="nav_media">
    			<a href="#"><span><h2>MEDIA</h2></span></a>
    		</div> <!--end of nav_media div-->
    		
    		<div id="nav_gigs">
    			<a href="#"><span><h2>GIGS</h2></span></a>
    		</div> <!--end of nav_gigs div-->
    		
    	</div> <!--end of main div-->
    	
    	<div id="right_column">
    		<div id="contact">
    			<a href="#"><span><h2>CONTACT</h2></span></a>
    		</div> <!--end of contact div-->
    ...............
    ...............
    
    

    I want to hover over nav_home and have nav_media and nav_gigs go to 40% opacity. Likewise if i hover over nav_media i want the other two divs to go transparent and the same for nav_gigs.

    I have the divs set up so that the span element in each takes up the entire area of the div - effectively making the entire area of the div into a clickable link.

    I'd really appreciate some help with this.

    EDIT: Got it sorted now


Comments

  • Registered Users, Registered Users 2 Posts: 10,245 ✭✭✭✭Fanny Cradock


    It would be nice for posterity if you posted the solution.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Simple CSS will do it
    #main div {
      filter:alpha(opacity=40)
      opacity:0.4;
    }
    
    #main div:hover {
      filter:alpha(opacity=100)
      opacity:1;
    }
    


  • Registered Users, Registered Users 2 Posts: 1,501 ✭✭✭gnolan


    Liam Byrne wrote: »
    Simple CSS will do it
    #main div {
      filter:alpha(opacity=40)
      opacity:0.4;
    }
    
    #main div:hover {
      filter:alpha(opacity=100)
      opacity:1;
    }
    

    I don't see how that would work - my three divs home, media and gigs would start off opaque and then each would be restored to full 100% opacity when i hover over it.

    What i wanted was all three divs beginning with 100% opacity - then when i hover over any of home, media, gigs; the remaining two divs go to 40% opacity, while the div i'm hovering over retains its full opacity. I'm finding hard to explain with words
    It would be nice for posterity if you posted the solution.


    I got help on another forum. Here is the solution posted which is working perfectly for me.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    gnolan wrote: »
    What i wanted was all three divs beginning with 100% opacity - then when i hover over any of home, media, gigs; the remaining two divs go to 40% opacity, while the div i'm hovering over retains its full opacity. I'm finding hard to explain with words

    There would be a bit more to it then - sorry!

    If you prefix the above with the #main:hover instead of #main it might do the trick for you; that way the opacity won't kick in until you hover the menu, after which one of the elements would be "lit" anyway


  • Registered Users, Registered Users 2 Posts: 15 shanno06




  • Advertisement
  • Registered Users, Registered Users 2 Posts: 10,245 ✭✭✭✭Fanny Cradock


    I don't see anything about hovering/ opacity there :confused:


Advertisement