- This topic is empty.
-
AuthorPosts
-
October 23, 2013 at 8:55 am #153846nummelinParticipant
Hello I’m new here and few months old in the HTML and CSS world.
I’m working on my website and I’m stuck at this point about hovering and changing background.
This is the page how it looks like at the moment.
http://www.lorenzomeschini.com/architecture/barcelona
I’m trying to make that when the mouse hover the different links in the menu, the vertical sidebar (the background of the menu) get a different background for every links.
Here I give you a “clean” version of my html and css.
http://jsfiddle.net/daFDn/1597/
I would really appreciate if someone could help me.
October 23, 2013 at 9:01 am #153849Paulie_DMemberSo as I understand it you want each list item (when you have created them) to have a different background?
Is that right? Or just when hovered?
October 23, 2013 at 9:16 am #153853nummelinParticipantI want that when I hover the different list item (thank you for the hint) I see a different background-image under the whole menu (sidebar), not just the single item.
Like when I hover item A, I see picture 1 hovering item B, picture 2,…..
October 23, 2013 at 9:21 am #153854Paulie_DMemberAh…you can’t do that with CSS as there is no
parent
selector.You can do it with Javascript / Jquery though.
October 23, 2013 at 9:38 am #153857nummelinParticipantYou mean that a child element cannot change the parent item background?
what about this exemple found in the other topic?
http://jsfiddle.net/daFDn/4/What is the difference?
thxOctober 23, 2013 at 10:18 am #153861Paulie_DMemberThat’s not changing the background of the
ul
it’s changing the background of something else but feel free to give it a try if it suits your needs.October 23, 2013 at 10:47 am #153864nummelinParticipantWell I did tried and I got stuck, I’m not sure if it’s possible to use that method or is me that I’m applying it in the wrong way, that’s why I’m asking here.
Do you have any suggestions about javascript or jquery?
October 24, 2013 at 6:32 am #153925lukefrakeParticipantHey Nummelin,
I have done this for you, I think it should be what you want, might not be the cleanest bit of jQuery but might give you some ideas going forward.
October 24, 2013 at 10:20 am #153952nummelinParticipantThank you lukefrake!
Looks exactly what I was trying to do, I just dont know why when I copy my html,css and js into CodePen everything works fine, and when I try to preview on google Chrome (or just upload everything on my ftp) it doesnt work.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.