简体   繁体   中英

Fancybox2: changing both overlay background color and padding around image

I'm a total JS noob - I tried to modify my Fancybox2 installation following the tipps on the fancybox site, but I can't get it to work. What I want is 1. a white overlay instead of a black one, appr 70% opacity and 2. a reduced padding (2px instead of the default 15). I was redirected to JSFiddle and I can change the code there for each of the two issues separately - but I cannot combine both. And: I don't know where to paste that code. Can anybody help me? Thanks in advance!

This did the trick for changing the padding:

$(".fancybox")
    .attr('rel', 'gallery')
    .fancybox({
    padding: 2
});

and this worked for the background color:

$(".fancybox").fancybox({
    helpers : {
        overlay : {
            css : {
                'background' : 'rgba(255, 255, 255, 0.75)'
            }
        }
    }
});

However, I don't know how to combine and where to put that. Thanks in advance!

$(".fancybox")
    .attr('rel', 'gallery')
    .fancybox({
    padding: 2,
    helpers : {
        overlay : {
            css : {
                'background' : 'rgba(255, 255, 255, 0.75)'
            }
        }
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM