[Tilt Effect] Parallax Photo Frame Using Vanilla Javascript

Parallax Photo Frame is a modern photo frame with an interactive parallax tilt effect, created with Vanilla JavaScript and CSS / CSS3.

tilt hover effect, tilt effect, image tilt effect css, tilt js, move background perspective on mouse move effect, 3d css parallax depth effect, parallax effect, mouse hover parallax effect

How to make use of it:

1. Add photos to the photo frame.

<div class="container">
  <div class="card-container">
    <div class="card">
      <img class="background" src="bg-1.jpg" alt="" />
      <img class="foreground" src="fg-1.png" alt="" />
    <div class="card">
      <img class="background" src="bg-2.jpg" alt="" />
      <img class="foreground" src="fg-2.png" alt="" />
    <div class="card">
      <img class="background" src="bg-3.jpg" alt="" />
      <img class="foreground" src="fg-3.png" alt="" />

2. The needed CSS styles.

.container {
  transform-style: preserve-3d;
  border-radius: 30px;
  background: #333;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
  padding: 15px;

.container .card-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

.container .card-container .card {
  height: 350px;
  width: 250px;
  overflow: hidden;
  position: relative;
  margin: 15px;
  border-radius: 15px;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.9);
  border: 4px solid #fff;

.container .card-container .card .background {
  height: 100%;
  width: 100%;
  object-fit: cover;
  transform: scale(1.1);
  filter: blur(2.5px);

.container .card-container .card .foreground {
  position: absolute;
  bottom: -25px;
  left: 0;
  height: 100%;
  width: 100%;
  transform-style: preserve-3d;

3. The primary script to allow the parallax tilt effect.

let container = document.querySelector(".container");
let foregrounds = document.querySelectorAll(".foreground");
document.body.addEventListener("mousemove", (e) => {
  let x = (window.innerWidth / 2 - e.pageX) / 30;
  let y = (window.innerHeight / 2 - e.pageY) / 30;
  container.style.transform = `rotateX(${-y}deg) rotateY(${-x}deg)`;
  [].forEach.call(foregrounds, (foregrounds) => {
    foregrounds.style.transform = `translateY(${y}px) translateX(${x}px)`;

Photo Frame With Parallax Tilt Effect Plugin/Github

See Demo And Download

Official Website(ShaileshBisht): Click Here

This superior jQuery/javascript plugin is developed by ShaileshBisht. For extra Advanced Usages, please go to the official website.

Related Posts


How to Create a Simple Cookie Banner Consent Using Bootstrap 4

Cookie Consent Popup Javascript – Quick and simple tutorial for creating a simple Bootstrap cookie banner. If you have a website or blog with people visiting or…


Create Custom HTML Terminals With Pure JavaScript | shell.js

Custom HTML Terminals is A JavaScript library to create HTML terminals on web pages. The shell js JavaScript library offers a straightforward method to create Ubuntu, OS X,…


Bootstrap Alert, Confirm, and Flexible Dialog Boxes | Bootbox

Bootbox.js is a small JavaScript library that allows you to create programming dialogs using Bootstrap templates, without having to worry about creating, managing, or removing any required…


An Accessible Touch-enabled Slider Web Component | fg-carousel

fg-carousel Slider – A simple & modern slider web component to create versatile, accessible, touch-enabled picture carousels utilizing CSS scroll snap, Custom Element, and Intersection Observer API….


A Lightweight and Efficient Tags Input Component in Vanilla JS | tagify

tagify transforms an input field or textarea into a tags component, in an easy and customizable way, with great performance and a small code footprint, full of…


A Lightweight Library to Copy Text to Clipboard | CopyJS

CopyJS is a lightweight JavaScript library that allows you to copy plain text or HTML content to the clipboard. Must Read: Tiny Library for Copy Text In…