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
Dropdown menu problem
Old 07-11-2012, 08:25 AM Dropdown menu problem
pealo86's Avatar
Super Spam Talker

Posts: 878
Name: Matt Pealing
Location: England, north west
Trades: 0
I'm building the following website:
http://bit.ly/NlzavE

and I'm coding a dropdown menu in the navigation, in the same way that I do on a lot of other websites.

The problem I'm having here is that I need the parent link to remain in its hover state while its descendants are hovered.

I've managed this on several recent projects however on this one it just doesn't seem to be working! I can't even think what I'm doing different.

I've attached a screenshot to show how the parent link isn't showing as its hover state when it should.

Here is the code I'm using:
Code:
#nav {
    float: left;
    font: bold 14px 'Din Display Pro Medium', arial, helvetica, sans-serif;
    text-transform: uppercase;
}

#nav > li {
    float: left;
    padding: 5px 20px;
    position: relative;
}

#nav > li > a {
    color: #666666;
    display: block;
    float: left;
    padding: 5px 10px;
    text-shadow: 1px 1px #fff;
    text-decoration: none;
}

#nav > li > a:hover, #nav > li > a:active, #nav > .current_list_item > a {
    background: #231f20;
    background: linear-gradient(to bottom,  #231f20 0%,#391f36 100%);
    -pie-background: linear-gradient(to bottom,  #231f20 0%,#391f36 100%);
    border-radius: 5px;
    color: #fff;
    position: relative;
    text-shadow: none;
    z-index: 0;
}

#nav .children {
    display: none;
    background: #391f36;
    background: linear-gradient(to bottom,  #391f36 0%,#5a2057 100%);
    -pie-background: linear-gradient(to bottom,  #391f36 0%,#5a2057 100%);
    border-radius: 0 5px 5px 5px;
    float: left;
    left: 20px;
    padding: 10px;
    position: absolute;
    top: 35px;
    width: 250px;
}

#nav .children li {
    float: left;
    display: inline;
}

#nav .children a {
    background: url('../image/icon-arrow-01.png') no-repeat 0 7px;
    color: #b3b3b3;
    display: block;
    float: left;
    margin-right: 20px;
    padding-left: 15px;
    text-decoration: none;
}

#nav .children a:hover, #nav .children a:active, #nav .current_list_item a {
    color: #a4cd39;
}
Can anyone see what the issue might be? It's fairly simple CSS and as I say, I've managed it in the past and just can't see what is different about this one!
Attached Images
File Type: png Screen Shot 2012-07-11 at 13.20.21.png (22.0 KB, 4 views)
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 07-13-2012, 08:33 AM Re: Dropdown menu problem
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
CSS does not cascade backwards (meaning a child cannot affect the parent element).

You will have to use javascript to change the parent element state with (this.parentNode.className) in the onMouseOver event handler for the child element.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-14-2012, 01:58 AM Re: Dropdown menu problem
ChrissAmirian's Avatar
Junior Talker

Posts: 4
Name: Christopher Amirian
Location: Tehran, Iran
Trades: 0
Hi there do as follows:

1- find crftncntrcts/script/dropdown.js and open it
2- find the code below:

// animate .children on hover
$('#nav .dropdown').hoverIntent(function() {
$(this).find('.children').slideDown(500);
}, function() {
$(this).find('.children').slideUp(500);
});

and change it to this:

// animate .children on hover
$('#nav .dropdown').hoverIntent(function() {
$(this).find('.children').slideDown(500);
$(this).find('a').addClass('hovered');
}, function() {
$(this).find('.children').slideUp(500);
$(this).find('a').removeClass('hovered');
});

3- in the crftncntrcts/information.htm add a css rule like this:

.hovered {
background: #231F20;
background: -webkit-linear-gradient(to bottom, #231F20 0%,#391F36 100%);
-pie-background: -webkit-linear-gradient(to bottom, #231f20 0%,#391f36 100%);
border-radius: 5px;
color: white;
position: relative;
text-shadow: none;
z-index: 0;
}

Hope this can help.

Regards;

Christopher Amirian
ChrissAmirian is offline
Reply With Quote
View Public Profile Visit ChrissAmirian's homepage!
 
Reply     « Reply to Dropdown menu problem
 

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.15161 seconds with 12 queries