how do you set up a link/image so when you hover an image, a link on the page turns to the hover state and vice versa?
Similar to what this site has: http://www.adrianlawrence.co.nz/
Any help would be great!
Thanks!
You can attach an event listener to one (image or link) to listen for mouseover. Have that fire a function which will find the element of the matching ID (image and link matching, ie image id = "image1", link id = "link1") and change the CSS.
Pure CSS and HTML can definitely be used to create an effect similar to the website you linked to.
Check out this fiddle .
a
element. ID
. The HTML:
<a href="www.google.com">
Hello there.
<img id="img1" src="[SOURCE]" alt="Be Happy!" />
</a>
The CSS:
/* The Important Stuff */
#img1 {
position:absolute;
bottom:20px;
right:45px;
}
a:hover {
text-decoration:none;
}
a:hover img {
opacity:.8;
}
/* The Unimportant Stuff */
body {
background-color:black;
}
a {
color:white;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.