2015-04-08 13:45
浏览 47


I have this line of PHP:

$STRING .= $b_f.'<a href="'.get_home_url().'/wp-login.php" class="ua5 '.$linkclass.'">'.$CORE->_e(array('head','5','flag_link')).'</a>'.$b_a;

This url opens now as a new webpage. How can i open it as a dialog/modal window instead? In my code i have bootstrap installed.

图片转代码服务由CSDN问答提供 功能建议


  $ STRING。= $ b_f。'&lt; a href =“'。get_home_url()。'/ wp-login.php”class =“ua5'。$ linkclass。'”&gt;'。$ CORE-  &GT; _E(阵列( '头', '5', 'flag_link')) '&LT; / A&GT;'。$ b_a; 

此网址现在作为新网页打开。 如何将其作为对话框/模态窗口打开呢? 在我的代码中,我安装了bootstrap。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drzdu44226 2015-04-08 14:12

    Try this "trick":

    <a href="http://twitter.github.io/bootstrap/" class="btn bootpopup" title="This is title" target="popupModal2">Open modal</a>
    <div id="popupModal2" class="modal hide fade" tabindex="-1" role="dialog">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">×</button>
        <div class="modal-body">
          <iframe src="" style="zoom:0.60" frameborder="0" height="250" width="99.6%"></iframe>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">OK</button>

    and the js:

      var frametarget = $(this).attr('href');
      var targetmodal = $(this).attr('target');
      if (targetmodal == undefined) {
        targetmodal = '#popupModal';
      } else { 
        targetmodal = '#'+targetmodal;
      if ($(this).attr('title') != undefined) {
        $(targetmodal+ ' .modal-header h3').html($(this).attr('title'));
        $(targetmodal+' .modal-header').show();
      } else {
         $(targetmodal+' .modal-header h3').html('');
        $(targetmodal+' .modal-header').hide();
        $(targetmodal).on('show', function () {
            $('iframe').attr("src", frametarget );   
      return false;

    Just pass your link to the button's href.


    点赞 打赏 评论

相关推荐 更多相似问题