Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UIkit lightbox Iframe plugin
(function () {
"use strict";
UIkit.on('beforeready.uk.dom', function () {
UIkit.plugin("lightbox", "iframe", {
init: function (lightbox) {
lightbox.on("showitem.uk.lightbox", function (e, data) {
var resolve = function (source, width, height) {
data.meta = {
'content': '<iframe class="uk-responsive-width" src="' + source + '" width="' + width + '" height="' + height + '"></iframe>',
'width': width,
'height': height
};
data.type = 'iframe';
data.promise.resolve();
};
if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) {
resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600));
}
});
}
});
});
}());
@malles

This comment has been minimized.

Copy link
Owner Author

@malles malles commented May 22, 2015

Make sure to add the data-lightbox-type="iframe" attribute to the lightbox!

@fordiy

This comment has been minimized.

Copy link

@fordiy fordiy commented Nov 18, 2015

Excellent! It works!

@ji4

This comment has been minimized.

Copy link

@ji4 ji4 commented May 24, 2016

It works! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment