2014-01-18 40 views
0

我偶然發現了一個類似的問題,但並不完全符合我的要求(Fancy box, grab from url)。我想用自舉模式做同樣的事情。我確實通過添加data-remote找到了一些教程,它不起作用。這也不完全是我想要做的。我想要的只是一種模式。沒有任何標題,主要部分或頁腳的代碼。所有這些都將包含在外部頁面中(該頁面實際上仍然位於服務器上)。所以基本上是這樣的<a href="/chat/alternate" class="action-modal">faq</a>的鏈接將被列入,它就會打開一個裸模態Bootstrap從另一個文件打開目錄

<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
//ajax loads the external page stuff into here. 
</div> 

那麼外部頁面(即在同一臺服務器上)上會包含這樣的事情:

<div class="modal-dialog"> 
<div class="modal-content"> 
    <div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> 
    <h4 class="modal-title" id="myModalLabel">Modal title</h4> 
    </div> 
    <div class="modal-body"> 
    ... 
    </div> 
    <div class="modal-footer"> 
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
    <button type="button" class="btn btn-primary">Save changes</button> 
    </div> 
</div><!-- /.modal-content --> 

我希望這是可能的。謝謝您的幫助!

+0

每次單擊鏈接時是否應該重新加載標記? – czarchaic

+0

我實際上已經找到了1/2,但仍然需要幫助。我終於得到了數據遠程工作,但我必須在幾乎每個頁面上放置'

'。有沒有辦法讓javascrip自動填充代碼?至於你的問題,是的,它應該每次都重新加載標記。 – nahtnam

+0

你可以只從服務器加載整個事情嗎?有了你必須把每一頁上已經包裹模態標記的部分? – czarchaic

回答

1

我想通了。在主頁上,把

<a href="" data-toggle="modal" data-target=".modal" data-remote="URL_HERE">TEST/a> 

以及本:

<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true"> 
</div> 

然後簡單地把像這樣在遠程站點上。

<div class="modal-dialog"> 
<div class="modal-content"> 
<div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> 
    <h4 class="modal-title" id="myModalLabel">title</h4> 
</div> 
<div class="modal-body"> 
    ... 
</div> 
<div class="modal-footer"> 
    <a href="" class="btn btn-primary" target="_blank" role="button">Go! &raquo;</a> 
</div> 
</div> 
</div> 
相關問題