Submit your widget

Useful JQuery Slide Popup

Created 12 years ago   Views 56345   downloads 11869    Author webstutorial
Useful JQuery Slide Popup
View DemoDownload
93
Share |

In this demo we'll going to share a new way to show a pop up message. Everyone is getting bored with typical fade in fade out pop up messages. So let’s make it interesting with a pinch of jquery and css.

we are going to make two javascript functions which will be used to slide in and slide out a div.

function openOffersDialog() {
    $('#overlay').fadeIn('fast', function() {
        $('#boxpopup').css('display','block');
        $('#boxpopup').animate({'left':'30%'},500);
    });
}
 
function closeOffersDialog(prospectElementID) {
    $(function($) {
        $(document).ready(function() {
            $('#' + prospectElementID).css('position','absolute');
            $('#' + prospectElementID).animate({'left':'-100%'}, 500, function() {
                $('#' + prospectElementID).css('position','fixed');
                $('#' + prospectElementID).css('left','100%');
                $('#overlay').fadeOut('fast');
            });
        });
    });
}

In the first function we are making a call to a div to fadeIn and in that fade in function we are sliding our popup from right to left.

The next function is used to slide the function from center of the screen to the extreme left side so it appears us to be disappeared. In this function we also set the overlay div to fadeout.

So let’s construct with our HTML part.

<body onload="openOffersDialog();">
<div id="wrapper">
<div id="overlay" class="overlay"></div>
<a onclick="openOffersDialog();">Click Here To See The PopUp</a>
<div id="boxpopup" class="box">
    <a onclick="closeOffersDialog('boxpopup');" class="boxclose"></a>
    <div id="content">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.
    </div>
</div>
</div>
</body>

The article source:http://www.webstutorial.com/jquery-popup-jquery-slide-popup/jquery