JQuery parallax
How do I make an jquery parallax?
By Marius. What is a jquery parallax? How do you make a jquery parallax? This script and codes were developed by Ghost Rider on 23 July 2022, Saturday.
JQuery parallax - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery parallax</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="scene"> <div data-offset="90" class="clouds parallax"></div> <div data-offset="30" class="trees parallax"></div> <div data-offset="20" class="grass parallax"></div> <div data-offset="50" class="buildings parallax"></div> <div class="ground"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
JQuery parallax - Script Codes CSS Codes
body { background:#84dbd7; overflow:hidden;
}
.scene { position:absolute; bottom:0; left:0; overflow:hidden; right:0; border-bottom:100px solid #342a2a; height:800px;
}
.scene > div { position:absolute; bottom:0;
}
.ground { width:100%; height:30px; background:#1d1818; z-index:999;
}
.scene > div.clouds { width:895px; left:50%; margin-left:-447px; height:253px; bottom:250px; background:url(http://i.imgur.com/WYfbo0O.png) no-repeat center;
}
.scene div.trees { width:908px; height:174px; background:url(http://i.imgur.com/4JOfJhg.png) no-repeat center; z-index:100; left:50%; bottom:20px; margin-left:-454px;
}
.scene div.grass { width:964px; height:37px; z-index:200; left:50%; bottom:20px; margin-left:-482px; background:url(http://i.imgur.com/h0aXbZr.png) no-repeat center;
}
.buildings { width:763px; height:303px; left:50%; margin-left:-400px; background:url(http://i.imgur.com/5LmAigM.png) no-repeat center; }
JQuery parallax - Script Codes JS Codes
//Illustration by http://psdblast.com/flat-color-abstract-city-background-psd
$(window).on('mousemove', function(e) { var w = $(window).width(); var h = $(window).height(); var offsetX = 0.5 - e.pageX / w; var offsetY = 0.5 - e.pageY / h; $(".parallax").each(function(i, el) { var offset = parseInt($(el).data('offset')); var translate = "translate3d(" + Math.round(offsetX * offset) + "px," + Math.round(offsetY * offset) + "px, 0px)"; $(el).css({ '-webkit-transform': translate, 'transform': translate, 'moz-transform': translate }); }); });
Developer | Ghost Rider |
Username | GhostRider |
Uploaded | July 23, 2022 |
Rating | 3 |
Size | 2,230 Kb |
Views | 91,080 |
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 |
A Pen by Ghost Rider | 57,648 Kb |
Sudoko Solver | 29,760 Kb |
Under construction | 1,642 Kb |
Laserz... | 1,848 Kb |
CSS Image Slider | 3,255 Kb |
CSS Animation | 7,029 Kb |
Google MAP | 10,594 Kb |
Shapes of CSS | 6,042 Kb |
Codepen search | 12,389 Kb |
Canvas Heart | 3,161 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 |
Bootstrap 4 Gridsystem Demo | Rivella50 | 1,535 Kb |
Mostly Fluid | Mccreath | 3,308 Kb |
Magnus 3 | ARocketfish | 7,944 Kb |
Marching Squares Visualized | Sakri | 7,074 Kb |
Bootstrap example | Ssaakkaa | 2,716 Kb |
Vanilla JS - A toggleClass function | Woodwork | 2,532 Kb |
Hc first draft | Stepfray | 5,104 Kb |
Typefaces with descriptions | Megandoty | 2,944 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
IE11 Test | Boostnewmedia | 4,998 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!