parallax.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js"></script>
<style>
#scene{
width: 500px;
height: 300px;
position: fixed;
top: 50%;
left: 50%;
margin-top: -150px;
margin-left: -250px;
text-align: center;
}
#scene div{
text-align: center;
font-size: 25px;
font-weight: 800;
}
.list{
display: none;
}
</style>
</head>
<body>
<div class="list">I love you very much</div>
<div id="scene">
<div data-depth="0.5">Remember to write back to me</div>
</div>
</body>
<script>
var scene = document.getElementById('scene');
var parallaxInstance = new Parallax(scene, {
relativeInput: true,
clipRelativeInput: false,
inputElement: null,
hoverOnly: false,
calibrateX: true,
calibrateY: true,
invertX: false,
invertY: false,
limitX: 100,
limitY: 100,
scalarX: 4.0,
scalarY: 4.0,
frictionX: 0.2,
frictionY: 0.2,
originX: 0.5,
originY: 0.5,
pointerEvents: true,
onReady: null,
selector: null
});
// parallaxInstance.friction(0.5, 0.5);
</script>
</html>