JavaScript Parallax Image Effect

Developer
Size
2,143 Kb
Views
52,624

How do I make an javascript parallax image effect?

JavaScript Parallax image effect created using vanilla-tilt.js.. What is a javascript parallax image effect? How do you make a javascript parallax image effect? This script and codes were developed by Html5andblog on 24 August 2022, Wednesday.

JavaScript Parallax Image Effect Previews

JavaScript Parallax Image Effect - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>JavaScript Parallax Image Effect</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="water" data-tilt data-tilt-max="20" data-tilt-speed="100" data-tilt-perspective="1000">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/130527/fish.png" class="fish" alt="goldfish">
</div> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/130527/vanilla-tilt.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

JavaScript Parallax Image Effect - Script Codes CSS Codes

body {
background-color: #003959;
}
.water {
max-width: 600px;
height: 500px;
position: relative;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/130527/water.jpeg') no-repeat;
background-size: cover;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
border-radius: 30px;
margin: 0 auto;
}
.fish {
max-width: 100%;
height: auto;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%) translateZ(50px);
-moz-transform: translate(-50%, -50%) translateZ(50px);
-ms-transform: translate(-50%, -50%) translateZ(50px);
-o-transform: translate(-50%, -50%) translateZ(50px);
transform: translate(-50%, -50%) translateZ(50px);
}
@media (max-width: 768px) { .water { height: 300px; } .fish { max-width: 60%; }
}

JavaScript Parallax Image Effect - Script Codes JS Codes

/*
Tutorial Available at:
https://www.html5andbeyond.com/parallax-image-effect-on-hover-lightweight-javascript-solution/
*/
/*
Images Used:
https://www.pexels.com/photo/underwater-blue-ocean-sea-9149/
https://pixabay.com/en/goldfish-carp-fish-1900832/
*/
JavaScript Parallax Image Effect - Script Codes
JavaScript Parallax Image Effect - Script Codes
Home Page Home
Developer Html5andblog
Username html5andblog
Uploaded August 24, 2022
Rating 4.5
Size 2,143 Kb
Views 52,624
Do you need developer help for JavaScript Parallax Image Effect?

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!

Html5andblog (html5andblog) Script Codes
Create amazing video scripts with AI!

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!