I am trying to create a link that opens a popup video when clicked. I was able to get it to work so far. However, I was wondering if there is a way for me to combine the HTML and JS code into 1. That way, I will not have to call the JS.
HTML
<style>
.mfp-title {
position:absolute;
color: #FFF;
background: maroon;
}
</style>
<a class="video" title="Living the Mission, A Perspective from Residential Life Staff at Boston College" href="http://www.bc.edu/content/dam/files/offices/reslife/mov/Living%20the%20Mission%20%20A%20Perspective%20from%20Residential%20Life%20Staff%20at%20Boston%20College.mp4">Open video</a>
JS
$('.video').magnificPopup({
type: 'iframe',
iframe: {
markup: '<div class="mfp-iframe-scaler">'+
'<div class="mfp-close"></div>'+
'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
'<div class="mfp-title">Some caption</div>'+
'</div>'
},
callbacks: {
markupParse: function(template, values, item) {
values.title = item.el.attr('title');
}
}
});
If that's not possible, how can I go about calling the JS file. If I do something like this
<script src="myScript.js"></script>
The video opens in full screen and user is taken to a different page. I don't want to have the user go to another page.
Any help would be appreciated.
<script>tag, did you place it in the<head>or at the end just inside the closing</body>tag?$(document).ready.window.onloadhandler to execute your script.