miromannino / Justified-Gallery

Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
http://miromannino.github.io/Justified-Gallery/
MIT License
1.68k stars 299 forks source link

Big image loading even with correct srcset and thumbnailPath #301

Closed peachp closed 5 years ago

peachp commented 5 years ago

I have a situation where at first the correct smaller size (e.g. TestPic05-800px.jpg) is loaded based on what I have in srcset and sizes attributes, but then the script loads the full-blown size of the image (e.g. TestPic05.jpg) and sets it as the thumbnail. image

I thought OK, it might be the script is loading the big size based on what is in the src attribute. So tocheck it, I have set thumbnailPath to the smaller image (I know it is hardcoded, but it is just to illustrate the issue).

$(document).ready(function(){

        var rowHeight = document.documentElement.clientWidth / 100 * 15;
        //alert(rowHeight);
        $("#justifiedGallery").justifiedGallery({
            rowHeight : rowHeight,
            maxRowHeight: rowHeight,
            lastRow : 'justify',
            margins : 1,
            captions: false,
            thumbnailPath: function (currentPath, width, height, image) {
                    return '/user/pages/04.modular/_row1/400/TestPic05-400px.jpg';
            }
        });
});

But it did not help. The script is still loading the big image after the small one image

Any ideas?