我似乎无法让模态窗口显示来自另一个链接的任何内容。我很确定我使用了正确的类将它们链接在一起。这是http://www.ericmmartin.com/projects/simplemodal_v101/给出的基本js .
jQuery(function ($) {
// Load dialog on page load
//$('#basic-modal-content').modal();
// Load dialog on click
$(' .basic').click(function (e) {
$('#basic-modal-content').modal();
return false;
});});
我已经把基础课放到
<li><a href="about me/about me.html" class='basic'>about me</a></li>
在外部 html 链接中(关于我)我放了一个 div id
<div id="basic-modal-content">
<p> Darrien is an industrial & product designer based from Toronto. My creative approach falls along the line of biomimicry and human-centric design.
I've recently graduated from the University of Guelph and am currently pursuing my Masters of Industrial Design at Pratt Institute.
Feel free to contact me to just chat and don't forget to look at some of my work.
</p>
我已将我的代码包含在这个 zip 中 ( http://www.4shared.com/zip/LGOb7yugba/Darrien_Website_V2.html )
任何帮助将不胜感激! :)
最佳答案
您遇到以下问题:
- 用户点击您的链接
- 触发点击事件
- Javascript 处理一些 ID 等于 basic-modal-content 的元素
- 没有这个ID的元素
- 浏览器加载关于页面
你必须做的:
- 用户点击链接(href='#')
- 触发点击事件
- 使用 JQuery .load()将about页面的html内容加载到特定div中的函数
- 调用 id 等于 basic-modal-content 的模态
- Javascript 将照管 basic-modal-content 并找到它
关于javascript - 无法让 Simplemodal 在模态窗口中显示链接内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24112497/