This isn’t exactly a unity issue just probably more a syntax problem.
I’m trying to launch a popup youtube video on top of the webgl content from with in Unity C#. Originally I was thinking of using window.open in javascript but this trigger the popup blocker.
As an example I have the following in my index.html
<a class="popup-youtube" href="http://www.youtube.com/watch?v=0O2aH4XLbto">Open YouTube video</a><script type="text/javascript">
$(document).ready(function() {
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
});
</script>
I’m using Magnific Popup (GitHub - dimsemenov/Magnific-Popup: Light and responsive lightbox script with focus on performance.) and the above link works as a test. But I’m trying to trigger the same functionality from inside a .jslib file.
var LibraryWebGLPopup = {
WebGLPopupShowURL: function(url)
{
var str = Pointer_stringify(url);
magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
},
};
mergeInto(LibraryManager.library, LibraryWebGLPopup);
I’ve getting an exception / error of “ReferenceError: magnificPopup is not defined” so I know unity is calling the correct function in my .jslib but I’m not sure if and how I can call ‘magnificPopup’ or not.
Any suggestions?