Create overlay with jquery and remove it by clicking

    [javascript]
    $(‘<div id="overlay"></div>’)
    .css({
    position : ‘fixed’,
    top : 0,
    left : 0,
    right : 0,
    bottom : 0,
    opacity : 0.6,
    background : ‘black’,
    display : ‘none’
    })
    .appendTo(‘body’)
    .fadeIn(‘normal’)
    .click(function () {
    $(this).fadeOut(‘normal’, function () {
    $(this).remove();
    })
    });
    [/javascript]

    Leave a Reply