hardik bhut
hardik bhut

Reputation: 45

not able to show image in popup

I have this issue: I want to open a image in a pop-up, but the image is not loaded in the pop-up.

Could someone tell me what's wrong with my code, I don't have any errors

This is a part of my code:

<?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">

I want to open the pop-up window by clicking (click event) on the image.

Upvotes: 2

Views: 1157

Answers (1)

praveen
praveen

Reputation: 194

It's happening because target div is hidden,you have to change its style before displaying of image popup.

Here i have used Facebook hook given at Facebook github repository.

Add below lines in Jquery ready function to attach a reveal event of Facebook.

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

Upvotes: 1

Related Questions