- This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
So i want to make when you hover over the #prvi div the #main changes it’s background color.
I tried something like this:
#prvi:hover #main{
background-color:#d5F986;
}
But that doesn’t work. Here is the[ codepen](http://codepen.io/markomarkogame/pen/DyIvo “codepen”).
What you need is a parent selector, which doesn’t exist yet. You can do it with jQuery though.
So it was done in jQuery [here](http://www.codeschool.com/ “here”) ? (the Paths sections)
Since I’m no good in jQuery i might as well give up on this ..
Yes, on that site they use JS (didn’t check if it is jQuery, but probably it is) to add classes like `path-ruby` to the container.
Here is how it can be done using jQuery: http://codepen.io/CrocoDillon/pen/tqEfh
@Krish1980, you’re removing all other classes from the parent div like `.parent`. That’s why I like jQuery so much, functions like `addClass` and `removeClass` automatically keep the other classes :)
Wow cool stuff guys.
@CrocoDillon nice fade in and out I was wondering where could i learn to do something like this, looks simple.
Anyone ? Any link to point me how to do this kind of stuff, nothing complicated ?
Start by learning [JavaScript](https://developer.mozilla.org/en-US/docs/JavaScript/Guide), then move on to (or skip to if you don’t feel like reading all that) [jQuery](http://try.jquery.com/). I haven’t really tried the last link yet but it seems rather easy with videos and exercises.