Last active
May 24, 2016 15:50
-
-
Save malles/423a1eb266f169d01edc to your computer and use it in GitHub Desktop.
UIkit lightbox Iframe plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)); | |
} | |
}); | |
} | |
}); | |
}); | |
}()); |
Excellent! It works!
It works! Thanks a lot!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to add the
data-lightbox-type="iframe"
attribute to the lightbox!