我一直在使用 jQuery Docs,我正在尝试设置一个从单独的 html 文件填充模态内容的情况。所有文件都在同一个域,同一个文件夹中。到目前为止,模式将在点击时启动,但没有从 html 文件中提取任何内容。我正在使用 Zurb 显示模态。
jQuery:
$('.video-btn').click(function (e) {
e.preventDefault();
var modalUrl = $(this).attr('href');
$('#myModal').load('modalUrl #vidModal').reveal({
animationspeed: 500,
animation: 'fadeAndPop',
dismissmodalclass: 'close-reveal-modal'
});
//$('.video-wrapper').children().show();
});
链接
<a href="modal1.html" class="info-btn video-btn">
<h2>Video</h2>
<p>Cambridge at a glance</p>
</a>
/*Outer modal hidden on page*/
<div id="myModal" class="reveal-modal"></div>/*Content that is in a file named modal1.html*/
<div id="vidModal" class="reveal-modal">
<div class="inner-modal">
<div class="modal-head">
<h2>Video</h2>
<p>Cambridge at a glance</p>
<a class="close-reveal-modal"></a>
</div>
<div class="modal-share-btns"></div>
<div class="video-wrapper">
<iframe id="vid" src="http://player.vimeo.com/video/20800836?api=1" width="700" height="400" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
</div>
</div>
<!-- /inner-modal -->
</div>