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 |
Get Image Ratio | 1,586 Kb |
Animated Search Icon | 2,528 Kb |
Clickable Dark Button | 1,830 Kb |
Scroll-dependent Fixed Nav | 3,390 Kb |
Logo Animation | 2,611 Kb |
Dim Extra Content | 2,148 Kb |
List experiment | 2,259 Kb |
Responsive Images | 2,284 Kb |
DataTables Custom Filter Demo | 3,327 Kb |
Contact List | 3,335 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 |
Project Euler Problem 17 | Bfillmer | 2,739 Kb |
Calculator - codevember 08 - 2016 | Caiocares | 3,260 Kb |
Commuter Line Tokyu 8500 | Pedox | 7,031 Kb |
Intake Form Page 2 | Ijantje | 4,983 Kb |
Nice responsive team page | Infomiho | 3,139 Kb |
Board Site | IndianaLuft | 10,542 Kb |
Table border-collapse property | Maxds | 1,672 Kb |
Process Accordion | Devilskitchen | 31,432 Kb |
CSS3 keyframe onload animation. | Samueljseay | 1,706 Kb |
Subscription Newsletter - Before inlining | Bradstrong | 7,526 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!