[英]not able to show image in popup
我有這個問題:我想在彈出窗口中打開圖像,但是該圖像未在彈出窗口中加載。
有人可以告訴我我的代碼有什么問題,我沒有任何錯誤
這是我的代碼的一部分:
<?php
defined('_JEXEC') or die('Restricted access');
$db = JFactory::getDBO();
$query=$db->getQuery (true);
$query->SELECT ('*');
$query->from('#__feature_film_image_data');
$db->setQuery( $query);
$results = $db->loadObjectList();
?>
<?php foreach($results as $result):?>
<div class="work mr9">
<a href="<?php echo $result->id; ?>" rel="facebox">
<img src="<?php echo $result->image; ?>" width="172" height="111">
</a>
</div>
<?php endforeach; ?>
<div class="popup-div">
<?php foreach($results as $result):?>
<div id="<?php echo $result->id; ?>" style="display:none;">
<img src="<?php echo $result->image?>" alt="some alt txt">
</div>
<br clear="all">
<?php endforeach; ?>
</div>
<br clear="all">
我想通過單擊圖像上的(單擊事件)打開彈出窗口。
發生這種情況是因為目標div被隱藏了,您必須在顯示圖像彈出窗口之前更改其樣式。
在這里,我使用了在Facebook github存儲庫中給出的Facebook鈎子。
在Jquery ready函數中添加以下行以附加Facebook的事件。
$(document).bind('reveal.facebox', function() {$('#facebox div.content image>div').parent('div').show() });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.