jQuery simplemodal closeHTML 问题

发布于 2024-10-09 19:15:10 字数 546 浏览 0 评论 0原文

我在使用 jquery.simplemodal 插件初始化模式窗口时遇到问题。

如果没有 closeHTML 选项,模式窗口的格式会正确。

$.modal(html, {});

但是,如果我指定 closeHTML,则模式窗口的格式将设置为适合带有滚动条的近 10x10 像素正方形。

$.modal(html, {
    closeHTML: '<a href="#close">Close</a>',
});

有没有人遇到过这个问题并且有解决办法?

相关规范是:

  • Ubuntu x86_64 上的 Chrome8
  • jQuery 1.4.4
  • jquery.simplemodal 1.4.1

I'm having an issue where when initializing a modal window using the jquery.simplemodal plugin.

With no closeHTML option, the modal window is formatted properly.

$.modal(html, {});

However, if I specify closeHTML, the modal window is formatted to fit in nearly a 10x10 pixel square with scrollbars.

$.modal(html, {
    closeHTML: '<a href="#close">Close</a>',
});

Has anyone run into this issue and have any idea for a fix?

Relevant specs are:

  • Chrome8 on Ubuntu x86_64
  • jQuery 1.4.4
  • jquery.simplemodal 1.4.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〆凄凉。 2024-10-16 19:15:10

I was able to work around this issue. I just removed the text from the <a class="modal-close">Close</a> and went with <a class="modal-close"></a> and a css background image. So really, if you want to use text in your <a>, like "x" or "close" this doesn't solve your problem, it just avoids the bug. Maybe this helps Eric spot the issue.

  • jQuery 1.4.4
  • jquery.simplemodal.1.4.1
篱下浅笙歌 2024-10-16 19:15:10

这个问题可以通过添加一个带有一些CSS的closeClass来解决:

JS

$.modal(html, {
  closeHTML: '<a href="#">close</a>',
  closeClass: 'acme-modal-close'
});

CSS

.acme-modal-close{
  display: inline;
  z-index: 3200;
  position: absolute;
  top: 5px;
  right: 5px;
  cursor: pointer;
}

This problem is solved by adding a closeClass w/ some CSS:

JS:

$.modal(html, {
  closeHTML: '<a href="#">close</a>',
  closeClass: 'acme-modal-close'
});

CSS:

.acme-modal-close{
  display: inline;
  z-index: 3200;
  position: absolute;
  top: 5px;
  right: 5px;
  cursor: pointer;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文