After upgrading fancybox to 2.1 the images get a d

2019-09-12 16:16发布

问题:

All images gets a 100px height, and auto width on top of screen - not centered (the images are higher than 100px). This happened when I upgraded to 2.1, latest version today. Is this a bug in the latest build?

The size seems to be correct when using the resize button - but still not centered vertically.

    $("a[href*='.jpeg'], a[href*='.jpg'], a[href*='.png'], a[href*='.gif']").attr("rel", "imagegroup").fancybox({
        prevEffect: 'elastic',
        nextEffect: 'elastic',
        helpers: {
            title: null,
            overlay: {
                opacity: 0.8,
                css: {
                    'background-color': '#000'
                }
            },
            thumbs: { // remove if you do not want thumbnails at bottom
                width: 50,
                height: 50
            },
            buttons: {} // remove if you do not want buttons at top
        }
    });

回答1:

It's not a bug. You may have upgraded the js files but forgot to upgrade the css files.

Fancybox js file v2.1.0 with fancybox css file v2.0.6 (or lower) will produce images 100px height and aligned to the top of the window.

SEE DEMO