Question

I'm developing a new site, and want to have a fancybox permanently open over it to display a "hello" message, but let users see a glimpse of the site behind until its ready to go fully live. I have fancybox 2 installed and working, I have also set it to open on page load (.trigger('click');) not sure why that works but it does!

Anyway I need to somehow disable clicking on the greyed background and corner X button.

How can I do this?

Était-ce utile?

La solution

Just add modal: true to your options and you are all set.

Something like :

$(".fancybox").fancybox({
    helpers : {
        overlay : {
            css : {
                // semi transparent overlay so you can have a glimpse 
                'background' : 'rgba(0, 0, 0, 0.35)'
            },
            locked: false // allows scroll the parent page
        }
    },
    modal: true // impossible to close ;)
}).trigger("click");

See JSFIDDLE

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top