Search code examples
jqueryresponsive-designmagnific-popuppreloading

Magnific Popup: Does plugin preload images for small screens?


If the Magnific Popup plugin is initialised using a disableOn argument and a preload argument, will the images preload for window widths smaller than the disableOn value?

For example, using the following initialise script, will images preload if the page loads in a window narrower than 720px?

$('.popup-gallery').magnificPopup({
    delegate: 'a',
    type:'image',
    gallery:{enabled:true},
    disableOn: 720,
    preload: [1,3]
});

Solution

  • No, it'll just open raw image, as if user just clicked on link.

    You'll need to code this feature manually, if you need it to work with disableOn too, take a look how default one is done in souce https://github.com/dimsemenov/Magnific-Popup/blob/master/src/js/gallery.js#L137