dxb-parallax
Version:
A vanilla JavaScript parallax scrolling plugin, a port of Ian Lunn’s jQuery Parallax v1.1.3
34 lines (32 loc) • 937 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DXB Parallax | Demo</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="wrapper">
<section class="normal-section">
<img src="https://placecats.com/millie/1920/1080" alt="" />
</section>
<section class="parallax-section"></section>
<section class="normal-section">
<img src="https://placecats.com/millie/1920/1080" alt="" />
</section>
</div>
<script src="script.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const ParallaxEl = new Parallax(
document.querySelector('.parallax-section'),
{
speedFactor: 0.6,
}
);
console.log(ParallaxEl);
});
</script>
</body>
</html>