-
AuthorPosts
-
February 14, 2019 at 12:55 pm #1066934
Hi,
on my website I use a sticky full width sub menu on which I styled the links.
The background is darker blue, each link has a lighter blue background with rounded corners. During mouse-over the background-color changes to the color of the section that the link is heading to.
To get an effect that looks like a little transparent window in the sub menue, I want the link’s background to pick up the hover color and keep it until the section is reached – and until another link is clicked. (as you have it, when you use an iPad for example)I thought I could do that in the quick css-box using the pseudo element :visited.
The hover-effect is working, but not the :visited-effect.This is, what I wrote:
#mg_navikiste_hallo {
background: #4C5B8C; color: white; padding-left: 15px; padding-right: 15px; padding-top: 7px; padding-bottom: 7px; border-radius: 12px; font-size: 18px;}
#mg_navikiste_hallo:visited {background: #7682A9;}
#mg_navikiste_hallo:hover {background: #7682A9;}Can you give me a hint what I did wrong?
Best regards
GrobiFebruary 15, 2019 at 2:05 pm #1067449This reply has been marked as private.February 16, 2019 at 5:03 am #1067613Hi,
The easiest solution for you is to use the classes that are added to the menu by the “Page Scroll To” plugin, since you are already using it.
So, you have a choice, you can use the “mPS2id-clicked” class for items clicked, but this will follow the user around changing the color on the items just because they clicked it, not because they are there. Or you can use the “mPS2id-highlight” class that will only change the color if the user is there, no matter if they clicked it or not.
I recommend the latter because it will make sense to the user, but it’s up to you.
the css for clicking the first menu item is:a.mPS2id-clicked span#mg_navikiste_hallo { background: #7682A9 !important; }
the css for hovering that item is:
a span#mg_navikiste_hallo:hover {background: #7682A9 !important; }
the css for the “highlight” class, meaning that you are there:
a.mPS2id-highlight span#mg_navikiste_hallo {background: #7682A9 !important; }
Note there are some settings for the plugin, such as *”highlight only one item at a time” & *”keep item highlighted until next item” that you may want to use. (*this is from memory, not the exact text)
Best regards,
MikeFebruary 17, 2019 at 12:36 pm #1067887Wow, Mike, cool!
It works and yor are right, the highlight-one is the better one!
Thank you very much!
Kind regards!
GrobiFebruary 17, 2019 at 12:38 pm #1067888This reply has been marked as private.February 18, 2019 at 1:09 am #1068072Hi,
I think I sorted out the “Jump-to-Nirvana” problem on Mac in the other thread, please check there.Best regards,
MikeFebruary 18, 2019 at 12:19 pm #1068303Hi Mike,
I already saw it – thanks a lot for this big job!Mike, after solving this link-highlight-thing above: what would you have proposed to me, if I did not already had used the “scroll to id”-plugin?
Was my way to try over “:visited” in principle right? Or was I already on the wrong track? Could I have solved this via CSS? Or does there have to be “php-support” in the background?In any case, thanks again for your help!
Kind regards
GrobiFebruary 19, 2019 at 2:28 am #1068706Hi,
The “:visited” would have remembered that setting until the cache was cleared, so changing the color for the next section would have been hard because there is no way to undo it.
If you were not using the plugin I would have suggested using the built-in classes for the menu colors with css, such as:
“current_page_item” & “current-menu-item”
I’m glad that it worked out, I assume we can close this now, but I like to ask. Shall we close this then?Best regards,
MikeFebruary 19, 2019 at 12:47 pm #1068916Hello Mike, yes, of course you can close this thread.
Thanks again for your effort – also regarding the other “Jump-to-nirvana” -thread.
I am afraid for you that we will meet again soon in this forum – namely, if I will have a question again … ;-)Kind regards
GrobiFebruary 19, 2019 at 9:37 pm #1069120Hi Grobi,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
VictoriaApril 24, 2019 at 5:27 pm #1094082Hi,
I just saw, that this topic is still open – in this case I do NOT need further help!Thank you very much!
Best regards
Grobi- This reply was modified 5 years, 7 months ago by Grobi. Reason: I forgot to write the word NOT - which is absolutely necessary in this sentence ;-)
April 24, 2019 at 10:16 pm #1094202Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘full width sub menue styling with :visited’ is closed to new replies.