2015-04-08 30 views
0

我此行的PHP:如何打开一个URL作为引导模态窗口?


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

该网址会立即打开一个新的网页。我怎样才能打开它作为对话框/模式窗口呢?在我的代码中,我安装了引导程序。

+0

尝试这种解决方案http://jsfiddle.net/XUnj8/1/它帮助我。 –

+0

Vic Abreu,它不会打开模式,只需点击该按钮即可让网页右滚动条消失。有什么建议么? – Yanivn78

+0

不是真的Yaniv Noodelman,这是一个为我工作的工作示例,它已经在JSFiddle上工作。 –

回答

2

试试这个 “绝招”:

<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> 
      <h3>Title</h3> 
    </div> 
    <div class="modal-body"> 
     <iframe src="" style="zoom:0.60" frameborder="0" height="250" width="99.6%"></iframe> 
    </div> 
    <div class="modal-footer"> 
     <button class="btn" data-dismiss="modal">OK</button> 
    </div> 
</div> 

和JS:

$('.bootpopup').click(function(){ 
    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); 
    }); 
    $(targetmodal).modal({show:true}); 
    return false; 

}); 

只是通过你的链接到该按钮的href

DEMO

+0

对不起Slim,它只会打开新标签中的链接... – Yanivn78

+0

@YanivNoodelman这是一个令人惊讶的例子。检查我的答案编辑 - 有一个演示链接。 – Slim

+0

谢谢Slim,我会这样做的 – Yanivn78

相关问题