【问题标题】:How to display an iframe popup on button click in wordpress?如何在 wordpress 中单击按钮时显示 iframe 弹出窗口?
【发布时间】:2017-11-21 05:12:22
【问题描述】:

您好,我是 Wordpress 的新手, 我有一个快速查询按钮,它位于我的帖子底部。 我想在单击该按钮时打开一个 iframe。

我尝试了一个名为 iframe popup 的插件,

<button style="background-color: #232254; text-decoration: none; color: #ffffff; width: 200px; height: 50px; border-radius: 15px 15px 15px;" onclick="forIframe();">Quick Enquiry</button>

<script type="text/javascript">
function forIframe()
{[iframe-popup category="Category1"];}</script>
</div>

但没有任何效果。

http://www.ithink.co/support_ticketing_system.html

请访问此链接,您将看到一个快速查询按钮。我想要它完全一样。 谢谢。

【问题讨论】:

  • 这里工作正常
  • 给定的链接是我想在我的 wordpress 帖子中重新创建的示例。 - @RajKumarBhardwaj
  • 你使用引导程序吗?
  • 我不认为这是一个 iframe,而是一个模态。尝试使用 wordpress 的模态插件,例如 wordpress.org/plugins/popup-maker 编辑:它是一个 iframe,但您可以使用模态实现此目的
  • iframe 弹出插件仅允许您在 x 秒后在模态框中加载 iframe。不幸的是,您无法将其设置为在单击事件时激活。

标签: javascript jquery html wordpress iframe


【解决方案1】:

您可以在 wordpress 中使用引导程序创建弹出窗口

<!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>

    <div class="container">
      <h2>Modal Example</h2>
      <!-- Trigger the modal with a button -->
      <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Quick Enquiry</button>

      <!-- Modal -->
      <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">

          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">Quick Enquiry</h4>
            </div>
            <div class="modal-body">
              <p>[iframe-popup category="Category1"]</p>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
          </div>

        </div>
      </div>

    </div>

    </body>
    </html>

【讨论】:

  • 非常感谢!
  • 欢迎 :) 乐于助人
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-14
  • 1970-01-01
相关资源
最近更新 更多