gpt4 book ai didi

php - 无法在弹出窗口中显示图像

转载 作者:行者123 更新时间:2023-11-30 05:48:32 25 4
gpt4 key购买 nike

我有这个问题:我想在弹出窗口中打开图片,但弹出窗口中没有加载图片。

谁能告诉我我的代码有什么问题,我没有任何错误

这是我的代码的一部分:

<?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 上提供的 Facebook Hook github存储库。

在 Jquery 就绪函数中添加以下行以附加 Facebook 的显示事件。

$(document).bind('reveal.facebox', function() {$('#facebox div.content image>div').parent('div').show() });

关于php - 无法在弹出窗口中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16297830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com