The code is based on: https://www.cssscript.com/parallax-tilt-effect-on-hover/ (My changes: Renamed the function, added a new function "outIn").
JS File -> parallax.js
<script type="text/javascript" src="assets/js/parallax.js"></script>
<div class="parallax">
<h2 class="card">Parallax Effect</h2>
</div>
window.addEventListener('load', () => {
setParallax('.card', {
fx3d: true, // enables fx3d class.
fxDistance: 70, // distance in px (optional).
});
});
// .card - the class of your element to which the effect will be applied.
setParallax('.card', {
perspective: 600,
});
setParallax('.card', {
maxTilt: 5,
});
setParallax('.card', {
mantain: true,
});
setParallax('.card', {
outIn: true,
});
// my function.