【问题标题】:Can't get Simplemodal to display link content in modal window无法让 Simplemodal 在模态窗口中显示链接内容
【发布时间】:2014-06-09 01:13:24
【问题描述】:

我似乎无法让模态窗口显示来自另一个链接的任何内容。我很确定我使用了正确的类将它们链接在一起。这是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 jquery html css simplemodal


【解决方案1】:

您有以下问题

  • 用户点击您的链接
  • 点击事件被触发
  • Javascript 会处理一些 ID 等于 basic-modal-content 的元素
  • 没有具有此 ID 的元素
  • 浏览器加载关于页面

你必须做什么

  • 用户点击链接(带有 href='#')
  • 点击事件被触发
  • 使用JQuery .load()函数将about页面的html内容加载到特定的div中
  • 调用 modal 的 id 等于 basic-modal-content
  • Javascript 会处理 basic-modal-content 并找到它

【讨论】:

  • 如果我是对的,症状:当你点击链接时,你只是跳转到 about_page 而不是获取模式
  • 它确实会生成一个模式,但它是空白的,并且没有显示关于页面内容的任何内容。
  • 您对模态的调用方式有疑问。或者它的元素内容。
  • 过去几天我一直在努力让它正常工作,但仍然无法正常工作。 :( 我尝试了各种 id 和类的组合来显示信息,但什么也没有。我完全不知所措!
猜你喜欢
  • 1970-01-01
  • 2020-05-11
  • 1970-01-01
  • 2021-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-09
相关资源
最近更新 更多