user5860904
user5860904

Reputation:

How to change fancybox width?

I have a gallery width 1920 width and long height, but fancybox show my images with fit width and height to the screen, I want to fit my image to screen width with height scrolling, here is my codes:

$.fancybox.open(attemp2.map(function (el) {
    return {
        src: el,
        opts: {
            caption: tempName,
        }
    };
}), {
    loop: false,
    toolbar: true
});

Upvotes: 0

Views: 858

Answers (1)

Christian Petry
Christian Petry

Reputation: 36

Here a little code snippet from my own usage of fancybox. I adjusted width and height by percentage.

$(".imagebox").fancybox({
    maxWidth    : 600,
    maxHeight   : 600,
    wrapCSS     : 'fancy-imagebox', // add a class selector to the fancybox wrap
    margin      : [0, 0, 0, 0],
    width       : '70%',
    height      : '90%',
    autoSize    : true
});

Upvotes: 1

Related Questions