jQuery & GSAP Based Modal Window with Motion Blur Effect

File Size: 2.67 KB
Views Total: 3577
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery & GSAP Based Modal Window with Motion Blur Effect

A stylish animated modal window with SVG filter based motion blur effect, built using jQuery, CSS3, SVG and GSAP JavaScript library (TweenMax.js).

How to use it:

1. Create a modal window that is hidden on page load.

<div class="modal">
  <button class="close-modal">×</button>
  <p>Modal Content</p>

2. Create a button to toggle the modal window.

<button class="open-modal">Open Modal</button>

3. Create a fullscreen overlay for the modal window.

<div class="modal-overlay"></div>

4. Create SVG elements for the motion blur effect. More information about SVG filters.

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="filters">
    <filter id="blur">
      <feGaussianBlur id="blur-filter" in="SourceGraphic" stdDeviation="0,0" />

5. The essential CSS/CSS3 styles.

* { box-sizing: border-box; }

.modal-overlay {
  background: rgba(51,51,68,0.4);
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;

.modal {
  background: #eeeaea;
  text-align: center;
  width: 230px;
  height: 320px;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border-radius: 3px;
  margin: auto;
  padding: 20px;
  -webkit-filter: url("#blur");
  filter: url("#blur");
  -webkit-transform: translate3d(0, -900%, 0);
  transform: translate3d(0, -900%, 0);

.close-modal {
  background: none;
  border: none;
  position: absolute;
  font-size: 20px;
  right: 10px;
  top: 10px;
  color: #334;
  outline: none;

.filters {
  position: absolute;
  width: 0;
  height: 0;

6. Load the latest jQuery library and TweenMax.js at the bottom of your document..

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.15.0/TweenMax.min.js"></script> 

7. Enable the modal window and the motion blur effect.

  var $obj=$(".modal")
  function setBlur(v){
    blur.setAttribute("stdDeviation", v);
  function getPos(){
    return $obj.position();
  var lastPos=getPos();
  function update(){
    var pos=getPos();
    var limit=20;
    var dx=Math.min(limit,Math.abs(pos.left-lastPos.left)*0.5);
    var dy=Math.min(limit,Math.abs(pos.top-lastPos.top)*0.5);
  var isOpen=false;
  	function openModal(){
  function closeModal(){

This awesome jQuery plugin is developed by lbebber. For more Advanced Usages, please check the demo page or visit the official website.