Adding multiple modals to a page

When I do that the modal opens to the top of the page. So if the link is towards the bottom of the page, you don’t even know that it opened because you have to scroll up to see it.

When I changed the media print as you suggest, I get 4 blank pages and then the 2 printed pages follow.

Now I did not use the wrap that you suggested. Didn’t fully understand that. This is how I have my modal set up; with includes:

    <div class="modal-overlay">
      <div class="modal-inner">
        <div class="modal-container">
          <div class="modal-header">
            <a href="#" class="modal-close">&times;</a>
          </div>
          <div class="modal-content-1 hide">
                    <!--#INCLUDE FILE="page1.asp"--> 
          </div>
          <div class="modal-content-2 hide">
            <!--#INCLUDE FILE="page2.asp"--> 
          </div>
        </div>
      </div>
    </div>

So do I use the wrap here or on the asp page and then also use a wrap on the link to open the modal, which are in different places on the page?

Thanks

No you misunderstood:)

You change it in the print style sheet as in my demo. :wink:

1 Like

OI think the problem is that we don’t have your full code. The demos above are proof of concept to show they work but when you apply them to your page you will need to negate any properties that may interfere with the printed result via your print style sheet.

For example if you have a position relative set on the parent of the modal then that may break the positioning when it comes to printing. That’s why it’s better to always keep your modals out of the basic HTML structure and place them at the end of the html before the body closing tag. If that is too difficult with includes then you have to ensure that the print sheet negates any unwanted behaviors.

It’s relatively straight forward once you realize what needs to be changed.

1 Like

Yes, sorry about that - got it!

Ok, keeping the modals out of the basic HTML - got it. Will move them; for some reason I thought they needed to always be just under the body opening tag.

I was experimenting last might on the example modals here with using Youtube video - works great. The only problem I have is that when the modal is closed and you are not done watching the video, the video keeps playing. So I spent several hours in looking up code to get the video to stop and was unsuccessful in doing that.

Some of the examples below require ID’s, but still can’t get it to stop. Would appreciate your thoughts on these codes. Wasn’t sure if this is something you are familiar with. Here they are below and thank you for your time and expertise.

<iframe width="410" height="400" src="https://www.youtube.com/embed/additionalurlgoeshere?rel=0&amp;controls=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
$("#myModal").on('hidden.bs.modal', function (e) {
    $("#myModal iframe").attr("src", $("#myModal iframe").attr("src"));
});
$('#myModal').on('hidden.bs.modal', function(e) {
  var $iframes = $(e.target).find('iframe');
  $iframes.each(function(index, iframe){
  $(iframe).attr('src', $(iframe).attr('src'));
  });
})
jQuery(".modal-backdrop, #myModal .close, #myModal .btn").live("click", function() {
        jQuery("#myModal iframe").attr("src", jQuery("#myModal iframe").attr("src"));
});
<script>

  $('.close-modal').click(function(e) {
    e.preventDefault();
    $('.video-embed').children('iframe').attr('src', '');
  });

</script>

I’m out at the moment but will look back in the morning. :slight_smile:

Unless someone else wants to jump in sooner on the video problem.

You probably found this already, but I would look here:

I don’t mind helping you apply this to your code, but could you please post a runnable demo we can work with.

In post #46 you have posted snippets of code and the introduced Bootstrap into the mix. Even if there is enough code in these snippets to recreate your problem, I don’t really want to go hunting for links to jQuery and Bootstrap (and then probably end up using different versions to you). An example with everything in one code block that I can copy/paste to my PC and run would be awesome (like post #13).

Yes, I did see that, but don’t understand how to incorporate it with the modal from you and that Paul worked on:

<table align="center" width="500"><tr>
<td align="center"><a href="#" data-open-modal data-modal="1">Video #1</a></td>
<td align="center"><a href="#" data-open-modal data-modal="2">Video #2</a></td>
<td align="center"><a href="#" data-open-modal data-modal="3">Video #3</a></td>
</tr></table>
     <div class="modal-overlay">
      <div class="modal-inner">
        <div class="modal-container">
          <div class="modal-header">
            <a href="#" class="modal-close">&times;</a>
          </div>
          <div class="modal-content-1 hide">
                    <!--#INCLUDE FILE="videos/tutorial-1.asp"--> 
          </div>
          <div class="modal-content-2 hide">
            <!--#INCLUDE FILE="videos/tutorial-2.asp"--> 
          </div>
           <div class="modal-content-3 hide">
            <!--#INCLUDE FILE="videos/tutorial-3.asp"--> 
          </div>

        </div>
      </div>
    </div>
<style>
html {
	box-sizing: border-box;
}
*, *:before, *:after {
	box-sizing: inherit;
}
.modal-overlay {
	position: fixed;
	top:0;
	left:0;
	display: none;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .2s ease;
}
.modal-overlay.active {
	display: table;
}
.modal-overlay.visible {
	opacity: 1;
}
.modal-inner {
	display: table-cell;
	vertical-align: middle;
}
.modal-container {
	margin: 0 auto;
	width: 50%;
	padding: 0 10px;
	min-width: 750px;
	max-width: 850px;
	max-height: 600px;
	overflow: auto;
	border: 1px solid;
	background: #fff;
	border-radius: 5px;
}
.modal-header {
	text-align: right;
}
.modal-close {
	margin-right: .25em;
	color: inherit;
	text-decoration: none;
	font-size: 2rem;
	font-weight: bold;
}
.modal-content {
	padding: 0 10px;
}
.modal-content p {
	margin: 0 0 1em;
}
.hide {
	display: none;
}
p.open {
	margin: 1em;
	text-align: center;
	font-size: 1em;
	font-weight: 600;
	color: #4c659b;
	text-transform: uppercase;
	font-family: Arial, Helvetica, sans-serif;
}
@media print {
	html,body{background:#fff!important;color:#000!important;}
	body.modal-visible  * {visibility:hidden!important;height:0;overflow:hidden;line-height:0;}
	body.modal-visible  .modal-overlay, body.modal-visible .modal-overlay * {visibility:visible!important;height:auto;overflow:visible;line-height:normal;}
	.modal-overlay,.modal-inner,.modal-container {display:block;width:auto;height:auto;background:#fff;}
	.modal-container{border:none;width:auto;height:auto;min-width:0;max-width:none;max-height:none;border-radius:0;overflow:visible}
	.modal-header{display:none;}
	.modal-overlay{position:absolute;top:0;left:0;}
}
</style>
<script>
window.onload = function () {
    var openModalLinks = Array.prototype.slice.call(document.querySelectorAll('[data-open-modal]'));
    var closeModal = document.querySelector('.modal-close');
    var modalOverlay = document.querySelector('.modal-overlay');
    var modalInner = document.querySelector('.modal-inner');
    var modalContent = document.querySelector('.modal-inner');
    var modalContent = Array.prototype.slice.call(document.querySelectorAll('div[class^="modal-content-"]'));

    var handleShowModal = function (id) {
        document.querySelector('body').classList.add('modal-visible');
        modalOverlay.classList.add('visible');
        modalOverlay.querySelector('.modal-content-' + id).classList.remove('hide');
    }

    var handleHideModal = function (event) {
        modalOverlay.classList.remove('active');
    }

    var handleOpenModal = function (event) {
        var id = event.target.getAttribute('data-modal');

        event.preventDefault();
        modalOverlay.classList.add('active');

        window.setTimeout(handleShowModal(id));
    }

    var handleCloseModal = function (event) {
        if (event.target !== event.currentTarget) {
            return;
        }

        event.preventDefault();
        document.querySelector('body').classList.remove('modal-visible')
        modalOverlay.classList.remove('visible');
        modalContent.forEach(function (modal) { modal.classList.add('hide') });

        modalOverlay.addEventListener(
            'transitionend',
            handleHideModal, {
                once: true,
                passive: true
            }
          );
    }

    openModalLinks.forEach(function (link) { link.addEventListener('click', handleOpenModal) });
    closeModal.addEventListener('click', handleCloseModal);
    modalInner.addEventListener('click', handleCloseModal);
}


</script>

This would be the embed code for each video (example video) that would come from the include file.

<body>
<center>
<iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</center>
</body>
</html>

Thank you James!

Here’s a working example that you should be able to adapt but @James_Hibbard may have to tidy up the js I added :).

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modal demo</title>
<style>
html {
	box-sizing: border-box;
}
*, *:before, *:after {
	box-sizing: inherit;
}
.modal-overlay {
	position: fixed;
	top:0;
	left:0;
	display: none;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .2s ease;
}
.modal-overlay.active {
	display: table;
}
.modal-overlay.visible {
	opacity: 1;
}
.modal-inner {
	display: table-cell;
	vertical-align: middle;
}
.modal-container {
	margin: 0 auto;
	width: 50%;
	min-width: 750px;
	max-width: 850px;
	max-height: 600px;
	overflow: auto;
	border: 1px solid;
	background: #fff;
	border-radius: 5px;
}
@media screen and (max-width:750px){
	.modal-container{min-width:0;width:80%;}
}
.modal-header {
	text-align: right;
}
.modal-close {
	margin-right: .25em;
	color: inherit;
	text-decoration: none;
	font-size: 2rem;
	font-weight: bold;
}
.modal-content {
	padding: 0 10px;
}
.modal-content p {
	margin: 0 0 1em;
}
.hide {
	display: none;
}
p.open {
	margin: 1em;
	text-align: center;
	font-size: 1em;
	font-weight: 600;
	color: #4c659b;
	text-transform: uppercase;
	font-family: Arial, Helvetica, sans-serif;
}
.modal-selection{
	display:flex;
	justify-content:space-between;
	max-width:600px;
	margin:auto;
}
.iframe-wrap{
	width:100%;
	position:relative;
	padding-top:65%;
}
.modal-overlay iframe{
	position:absolute;
	left:0;
	top:0;
	right:0;
	bottom:0;
	width:100%;
	height:100%;
}


@media print {
	html,body{background:#fff!important;color:#000!important;}
	body.modal-visible  * {visibility:hidden!important;height:0;overflow:hidden;line-height:0;}
	body.modal-visible  .modal-overlay, body.modal-visible .modal-overlay * {visibility:visible!important;height:auto;overflow:visible;line-height:normal;}
	.modal-overlay,.modal-inner,.modal-container {display:block;width:auto;height:auto;background:#fff;}
	.modal-container{border:none;width:auto;height:auto;min-width:0;max-width:none;max-height:none;border-radius:0;overflow:visible}
	.modal-header{display:none;}
	.modal-overlay{position:absolute;top:0;}
}

</style>
</head>
<body>
<div class="modal-selection"> <a href="#" data-open-modal data-modal="1">Video #1</a> <a href="#" data-open-modal data-modal="2">Video #2</a> <a href="#" data-open-modal data-modal="3">Video #3</a> </div>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<div class="modal-overlay">
  <div class="modal-inner">
    <div class="modal-container">
      <div class="modal-header"> <a href="#" class="modal-close">&times;</a> </div>
      <div class="modal-content-1 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
      <div class="modal-content-2 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
      <div class="modal-content-3 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
    window.onload = function () {
    var openModalLinks = Array.prototype.slice.call(document.querySelectorAll('[data-open-modal]'));
    var closeModal = document.querySelector('.modal-close');
    var modalOverlay = document.querySelector('.modal-overlay');
    var modalInner = document.querySelector('.modal-inner');
    var modalContent = document.querySelector('.modal-inner');
    var modalContent = Array.prototype.slice.call(document.querySelectorAll('div[class^="modal-content-"]'));

    var handleShowModal = function (id) {
        document.querySelector('body').classList.add('modal-visible');
        modalOverlay.classList.add('visible');
        modalOverlay.querySelector('.modal-content-' + id).classList.remove('hide');
		modalOverlay.querySelector('.modal-content-' + id).classList.add('isPlaying');
    }

    var handleHideModal = function (event) {
        modalOverlay.classList.remove('active');
    }

    var handleOpenModal = function (event) {
        var id = event.target.getAttribute('data-modal');

        event.preventDefault();
        modalOverlay.classList.add('active');

        window.setTimeout(handleShowModal(id));
    }

    var handleCloseModal = function (event) {
        if (event.target !== event.currentTarget) {
            return;
        }
		var el = document.querySelector('.isPlaying iframe');
        event.preventDefault();
        document.querySelector('body').classList.remove('modal-visible');
		el.setAttribute("src", el.getAttribute("src"));
		
        modalOverlay.classList.remove('visible');
        modalContent.forEach(function (modal) { modal.classList.add('hide');modal.classList.remove('isPlaying') });

        modalOverlay.addEventListener(
            'transitionend',
            handleHideModal, {
                once: true,
                passive: true
            }
          );
    }

    openModalLinks.forEach(function (link) { link.addEventListener('click', handleOpenModal) });
    closeModal.addEventListener('click', handleCloseModal);
    modalInner.addEventListener('click', handleCloseModal);
}

</script>
</body>
</html>

Don’t add the body tags with your includes!

You can’t include body tags in your includes as there is only one body tag allowed on a page and will corrupt the css and html.

Also the center tag was deprecated at the turn of the century and should not be used in web pages these days (along with the align=“” attribute you added to the table and tables should be used for links that are not tabular). :slight_smile:

Be careful with the code you add and leave the styling to CSS and not deprecated attributes or outdated html. :wink:

2 Likes

Looks good to me. The only improvements I would make would be to use modern JavaScript, but as we need to support IE11, that’s not possible :slight_smile:

+1. I had wanted to mention this before, but forgot.

2 Likes

Nicely done, thank you Paul. Will take note of other comments. Also, probably not necessary to use includes with your example. I appreciate it.

1 Like

I will not be using this in IE11. This is part of the editor which also doesn’t work in IE 11. The users are instructed that if using the editor, it’s not supported by IE11 and must use Edge, FF or Chrome.

Thank you James!

PS… As a side note, this does work in IE11.

1 Like

@PaulOB
When I use your entire code posted here, in this post #50, and use all 3 video modals - all is good.

<div class="modal-overlay">
  <div class="modal-inner">
    <div class="modal-container">
      <div class="modal-header"> <a href="#" class="modal-close">&times;</a> </div>
      <div class="modal-content-1 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
      <div class="modal-content-2 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
      <div class="modal-content-3 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
    </div>
  </div>
</div>

I want to use modal 2 with TEXT and not the video

<div class="modal-content-2 hide">
        <div class="iframe-wrap">
          Some Text Here
        </div>
      </div>

When doing this replacement from the video to the text, it works fine but the modal doesn’t close when clicking the “X”. Even if you touch outside the modal, it doesn’t close, like it does when using the video modals.
I altered to this, since not using an iframe, still doesn’t close by clicking the “X”.

<div class="modal-content-2 hide">
        
          Some Text Here
        
      </div>

So my question is… Am I missing something in the above code or is it further involved with the JS or the CSS?
Thanks, I appreciate your help.

Yes the js will break because you are trying to change the source of an iframe which doesn’t exist in that modal.

Check first if the iframe exists and then you won’t get an error and the code should work.

e.g.

	if (el){
		 el.setAttribute("src", el.getAttribute("src"));
		}

Instead of just:

	` el.setAttribute("src", el.getAttribute("src"));`

Full working code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modal demo</title>
<style>
html {
	box-sizing: border-box;
}
*, *:before, *:after {
	box-sizing: inherit;
}
.modal-overlay {
	position: fixed;
	top:0;
	left:0;
	display: none;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .2s ease;
}
.modal-overlay.active {
	display: table;
}
.modal-overlay.visible {
	opacity: 1;
}
.modal-inner {
	display: table-cell;
	vertical-align: middle;
}
.modal-container {
	margin: 0 auto;
	width: 50%;
	min-width: 750px;
	max-width: 850px;
	max-height: 600px;
	overflow: auto;
	border: 1px solid;
	background: #fff;
	border-radius: 5px;
}
@media screen and (max-width:750px){
	.modal-container{min-width:0;width:80%;}
}
.modal-header {
	text-align: right;
}
.modal-close {
	margin-right: .25em;
	color: inherit;
	text-decoration: none;
	font-size: 2rem;
	font-weight: bold;
}
.modal-content {
	padding: 0 10px;
}
.modal-content p {
	margin: 0 0 1em;
}
.hide {
	display: none;
}
p.open {
	margin: 1em;
	text-align: center;
	font-size: 1em;
	font-weight: 600;
	color: #4c659b;
	text-transform: uppercase;
	font-family: Arial, Helvetica, sans-serif;
}
.modal-selection{
	display:flex;
	justify-content:space-between;
	max-width:600px;
	margin:auto;
}
.iframe-wrap{
	width:100%;
	position:relative;
	padding-top:65%;
}
.modal-overlay iframe{
	position:absolute;
	left:0;
	top:0;
	right:0;
	bottom:0;
	width:100%;
	height:100%;
}


@media print {
	html,body{background:#fff!important;color:#000!important;}
	body.modal-visible  * {visibility:hidden!important;height:0;overflow:hidden;line-height:0;}
	body.modal-visible  .modal-overlay, body.modal-visible .modal-overlay * {visibility:visible!important;height:auto;overflow:visible;line-height:normal;}
	.modal-overlay,.modal-inner,.modal-container {display:block;width:auto;height:auto;background:#fff;}
	.modal-container{border:none;width:auto;height:auto;min-width:0;max-width:none;max-height:none;border-radius:0;overflow:visible}
	.modal-header{display:none;}
	.modal-overlay{position:absolute;top:0;}
}

</style>
</head>
<body>
<div class="modal-selection"> <a href="#" data-open-modal data-modal="1">Video #1</a> <a href="#" data-open-modal data-modal="2">Video #2</a> <a href="#" data-open-modal data-modal="3">Video #3</a> </div>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<div class="modal-overlay">
  <div class="modal-inner">
    <div class="modal-container">
      <div class="modal-header"> <a href="#" class="modal-close">&times;</a> </div>
      <div class="modal-content-1 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
   <div class="modal-content-2 hide">
        <div class="iframe-wrap">
          Some Text Here
        </div>
      </div>
      <div class="modal-content-3 hide">
        <div class="iframe-wrap">
          <iframe width="610" height="400" src="https://www.youtube.com/embed/z3cjTqCQemU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
    window.onload = function () {
    var openModalLinks = Array.prototype.slice.call(document.querySelectorAll('[data-open-modal]'));
    var closeModal = document.querySelector('.modal-close');
    var modalOverlay = document.querySelector('.modal-overlay');
    var modalInner = document.querySelector('.modal-inner');
    var modalContent = document.querySelector('.modal-inner');
    var modalContent = Array.prototype.slice.call(document.querySelectorAll('div[class^="modal-content-"]'));

    var handleShowModal = function (id) {
        document.querySelector('body').classList.add('modal-visible');
        modalOverlay.classList.add('visible');
        modalOverlay.querySelector('.modal-content-' + id).classList.remove('hide');
		modalOverlay.querySelector('.modal-content-' + id).classList.add('isPlaying');
    }

    var handleHideModal = function (event) {
        modalOverlay.classList.remove('active');
    }

    var handleOpenModal = function (event) {
        var id = event.target.getAttribute('data-modal');

        event.preventDefault();
        modalOverlay.classList.add('active');

        window.setTimeout(handleShowModal(id));
    }

    var handleCloseModal = function (event) {
        if (event.target !== event.currentTarget) {
            return;
        }
		var el = document.querySelector('.isPlaying iframe');
        event.preventDefault();
        document.querySelector('body').classList.remove('modal-visible');
		if (el){
		 el.setAttribute("src", el.getAttribute("src"));
		}
        modalOverlay.classList.remove('visible');
        modalContent.forEach(function (modal) { modal.classList.add('hide');modal.classList.remove('isPlaying') });

        modalOverlay.addEventListener(
            'transitionend',
            handleHideModal, {
                once: true,
                passive: true
            }
          );
    }

    openModalLinks.forEach(function (link) { link.addEventListener('click', handleOpenModal) });
    closeModal.addEventListener('click', handleCloseModal);
    modalInner.addEventListener('click', handleCloseModal);
}

</script>
</body>
</html>

You should probably remove the iframe-wrap when you just want text as you will get a big space above the text. I’m not sure how you want it to look but removing iframe-wrap from modal-content2 will make the modal content height instead.

1 Like

Yes, that did it. Makes sense with using the conditional statement.

Yes, I saw that, which is why I removed it, but couldn’t figure out my error.

Thank you for pointing that out and fixing my issue with the if statement. I really appreciate that and very much respect your vast knowledge in this matter. Take care!

1 Like

@PaulOB and @James_Hibbard - thank you both for your assistance with the video modals. I am using them and without your assistance, it wouldn’t have been possible. Thank you again!

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.