Image reveal on hover
How do I make an image reveal on hover?
What is a image reveal on hover? How do you make a image reveal on hover? This script and codes were developed by Mark Michon on 20 January 2023, Friday.
Image reveal on hover - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Image reveal on hover</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ section { margin: 3rem auto; width: 90vw; height: 90vh; transition: background-color .25s ease-in-out; position: relative;
}
ol { counter-reset: item; margin: 0; padding: 0;
}
li { display: inline-block; margin-left: 2em; font-size: 2em; line-height: 1.5;
}
li::before { content: counter(item,decimal-leading-zero); counter-increment: item; width: 2em; font-size: .5em;
}
img { position: absolute; top: center; left: 50%; margin-left: -300px; z-index: -1; opacity: 0; transition: opacity .5s ease-in-out;
}
.show { opacity: 1;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <section> <img src="https://unsplash.it/600/300/?image=1" alt="1" class="" /> <img src="https://unsplash.it/600/300/?image=2" alt="2" class="" /> <img src="https://unsplash.it/600/300/?image=3" alt="3" class="" /> <ol> <li data-color="red">Multi Word Project</li> <li data-color="blue">Singlename</li> <li data-color="green">Longer name than first</li> </ol>
</section> <script src="js/index.js"></script>
</body>
</html>
Image reveal on hover - Script Codes CSS Codes
section { margin: 3rem auto; width: 90vw; height: 90vh; transition: background-color .25s ease-in-out; position: relative;
}
ol { counter-reset: item; margin: 0; padding: 0;
}
li { display: inline-block; margin-left: 2em; font-size: 2em; line-height: 1.5;
}
li::before { content: counter(item,decimal-leading-zero); counter-increment: item; width: 2em; font-size: .5em;
}
img { position: absolute; top: center; left: 50%; margin-left: -300px; z-index: -1; opacity: 0; transition: opacity .5s ease-in-out;
}
.show { opacity: 1;
}
Image reveal on hover - Script Codes JS Codes
let items = document.querySelectorAll('li');
let section = document.querySelector('section');
let images = document.querySelectorAll('img');
const applyBackground = (color) => { section.style['background-color'] = color;
}
const clearBackground = () => { section.style['background-color'] = "";
}
items.forEach((item, i) => { let color = item.dataset.color; item.addEventListener('mouseenter', ()=> { // applyBackground(color); // console.log(images[i]); images[i].classList.add('show'); }) item.addEventListener('mouseleave', ()=> { clearBackground(); images[i].classList.remove('show'); })
})
Developer | Mark Michon |
Username | markmichon |
Uploaded | January 20, 2023 |
Rating | 3 |
Size | 2,995 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Responsive Images | 2,284 Kb |
Fluid Heart | 1,939 Kb |
Moving gradient | 2,619 Kb |
Scroll-dependent Fixed Nav | 3,390 Kb |
Dim Extra Content | 2,148 Kb |
Even images demo | 2,080 Kb |
A Pen by Mark Michon | 2,220 Kb |
Flex images demo | 1,857 Kb |
Flex-demo | 2,645 Kb |
Logo Animation | 2,611 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
This in constructor context | _shree33 | 1,718 Kb |
Pure CSS Spinners | Jlong | 2,043 Kb |
CSS Patterns | Alyda | 3,953 Kb |
Brown by pure CSS, no image, no javascript | Aaronchuo | 2,652 Kb |
Tail rose iris lined | Kbrtrm | 1,846 Kb |
Website Concept | Sagoza | 3,104 Kb |
A Pen by Ash | Littleginger | 2,386 Kb |
Animated rainbow wave on canvas | Icodeforlove | 2,777 Kb |
Hoi hoi | JohnTheCat | 7,248 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!