2010-09-22 155 views
0

有沒有人使用Joomla 1.5啓動頁面加載燈箱?joomla燈箱頁面加載

我想建立一個插件着火物品時,頁面加載的燈箱,但不知道漢王要做到這一點

+0

我已經做到了使用jQuery彩盒(燈箱)。但不是joomla默認的mootools燈箱。如果你想實現jQuery的一個。我可以告訴你。 – 2010-09-22 10:50:18

回答

1

其實原因很簡單,當你知道你在做什麼。 以下是使用Mootools 1.1和模態行爲的原生Joomla 1.5示例代碼。

如果你只想使用SlimBox,那麼你將不得不自己弄清楚。所有的SlimBox都有點不同...


爲了讓我們打開一個模式窗口,我們需要做2件事。包括JavaScript庫和樣式表。在我們的例子中,我們將包括modal.js

<?php 
// You do know need to include mootools explicitly 
// JHTML::_('behavior.modal') will include mootools library. 
JHTML::_('behavior.modal'); 
?> 

其次,包括JavaScript打開模態窗口。如果您包含PHP的JS,最好使用JFactory::getDocument()->addScriptDeclaration("// JavaScript Goes Here");將腳本包含到文檔的HEAD中。

<script type="text/javascript"> 

// Use either domready or load event to open the modalbox 
window.addEvent('domready', function(){ 
    var myAnchor = new Element('a', { 
     'href': 'http://www.google.com', 
     'class': 'myClass', 
     'rel' : "{handler: 'iframe', size: {x: 800, y: 550}}" 
    }); 
    SqueezeBox.fromElement(myAnchor); 
}); 
</script> 
0

另一種情況是當您在頁面上存在模態鏈接並且想要在頁面加載時顯示模態。用途:

window.addEvent('domready', function(){ 
    SqueezeBox.fromElement(document.getElementById('modalID')); 
}); 

其中存在鏈接:

<a class="modal" name="modalID" id="modalID" rel="{handler: 'iframe', size: {x: 400, y:  400}}" href="index.php?option=com_mycomponent&task=mytask&tmpl=component">Link Text</a>" 

這顯示模式的onload,有鏈接重新開放模式