Quantcast
Channel: w3cplus
Viewing all articles
Browse latest Browse all 1557

Create overlay with jquery and remove it by clicking

$
0
0

jQuery制作遮罩层的代码片段

$('<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();
        })
    });

Viewing all articles
Browse latest Browse all 1557

Trending Articles