Here is my code for simple modal box
I want to use 'easeOutBounce' easing effect of jquery.easing.1.3.js.
How to bounce modal window while opening and closing?
Please help
For jQuery Easing Effects http://ralphwhitbeck.com/demos/jqueryui/effects/easing/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Modal Window</title>
<style type="text/css">
#mask {
position: absolute;
left: 0;
top: 0;
z-index: 90;
background-color: #000;
display: none;
}
.window {
position: absolute;
left: 0;
top: 0;
width: auto;
height: auto;
display: none;
z-index: 99;
padding: 10px;
background-color: #fff;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.window .close {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
// Do all these functions when the document is loaded fully
$(document).ready(function(){
// Apply to all the Links which have the name attribute as modal
$('a[name="modal"]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
// Get the ID of the Content Element
var id = $(this).attr('href');
// Get the Screen's Height and Width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
// Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width': maskWidth, 'height': maskHeight});
// Transition Effect
$('#mask').fadeIn("fast");
$('#mask').fadeTo("fast",0.8);
// Get the Window's Height and Width
var winH = $(window).height();
var winW = $(window).width();
// Make the Content Window Center
$(id).css('top', (winH/2-$(id).height()/2<0)?0:winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
// Scroll smoothly to the Top
$("html,body").animate({scrollTop: 0}, "fast");
// Transition Effect
$(id).fadeIn("fast");
});
// Handle the Close Function (Button)
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').fadeOut("fast");
$('.window').fadeOut("fast");
});
// Handle the Close Function (Mask)
$('#mask').click(function () {
$('#mask').fadeOut("fast");
$('.window').fadeOut("fast");
});
});
</script>
</head>
<body>
<div id="mask"></div>
<a href="#cont" name="modal">Open</a>
<div class="window" id="cont">
Content
</div>
</body>
</html>