Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Make menu image change when clicked and stay.
Old 07-24-2008, 08:39 PM Make menu image change when clicked and stay.
Novice Talker

Posts: 5
Trades: 0
I have a CSS menu that I am trying to get to work all the way. Right now the hover works fine.

Here is the markup:

Code:
/* IMAGE ROLLOVERS */

a.home-button {
width: 127px;
height: 44px;
background: url(images/home-button.png);
}

a.home-button:hover, #navigation a:focus {
width: 127px;
height: 44px;
background: url(images/home-button-hover.png);
}
When someone clicks on the link and is taken to the new page I want the home-button-hover.png to replace home-button.

The images are tabs, hover-button.png is blue and home-button-hover.png is white. If I have the hover stay when the link is clicked it will show the visitor what page they are on, since the link image will be white.

As you can see I tried to make this happen by applying a:focus to the hover css but that didn't work.

p.s. #navigation is the div that the menu is in.

So how do I do this? (make hover stay when clicked)

p.s.s. I have tried making a:active the hover image but it only lasts while it is clicked then when the new page comes up the link goes back to normal.
navd is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-24-2008, 10:03 PM Re: Make menu image change when clicked and stay.
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
The easiest way is to define a class for the 'selected' tab and add that to code, like this:

a.selected{background: url(images/home-button-hover.png);

Then in your html just do this: <a class="selected" href=.......">home</a>
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 07-24-2008, 10:09 PM Re: Make menu image change when clicked and stay.
Novice Talker

Posts: 5
Trades: 0
Quote:
Originally Posted by LadynRed View Post
The easiest way is to define a class for the 'selected' tab and add that to code, like this:

a.selected{background: url(images/home-button-hover.png);

Then in your html just do this: <a class="selected" href=.......">home</a>

Thanks for your reply,

The only thing is that I am running off of wordpress so that won't work.
Wordpress is dynamic so that is going to be a little problem.
navd is offline
Reply With Quote
View Public Profile
 
Old 07-25-2008, 05:25 AM Re: Make menu image change when clicked and stay.
Novice Talker

Posts: 14
Name: Rik Weber
Trades: 0
It's still possible in Wordpress, though you will need to know a bit of PHP:

http://wordpress.org/support/topic/140559

It involves using Wordpress' in-built functions 'in_category' and 'is_category'.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
bobming is offline
Reply With Quote
View Public Profile
 
Old 07-25-2008, 10:53 AM Re: Make menu image change when clicked and stay.
Novice Talker

Posts: 5
Trades: 0
Thanks for that it looks like exactly what I need. The only thing is I need this to work for pages not categories. Since I have an about and contact page these are the only menu images that are going to change. How can I change the php line to work for categories?
navd is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Make menu image change when clicked and stay.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18770 seconds with 12 queries