Keyword

Image modal problem

  • Rober636
  • Rober636's Avatar Topic Author
  • Offline
  • New Member
More
3 months 4 weeks ago #175135 by Rober636
Image modal problem was created by Rober636
When I click on the image it doesn't open in a modal popup, it just opens in full web browser.

The Code:

<div class="catItemImage blog-item">
<div class="entry">
<span class="itemImage">
<a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
<img class="img-responsive" src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</a>
</span>
</div>
</div>
</div>

I miss something, but what?

Regards.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 months 3 weeks ago #175140 by Fotis
Replied by Fotis on topic Image modal problem
This is related to a JS error. Either the JS script used for the modal is cut off (Magnific Popup) or some other script breaks the entire JS code on your page. A URL would help...

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Rober636
  • Rober636's Avatar Topic Author
  • Offline
  • New Member
More
3 months 3 weeks ago - 3 months 3 weeks ago #175141 by Rober636
Replied by Rober636 on topic Image modal problem
URL

Regards
Last edit: 3 months 3 weeks ago by Rober636.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 months 3 weeks ago #175143 by Fotis
Replied by Fotis on topic Image modal problem
To make sure we don't load unnecessary JS code in a Joomla site, Magnific Popup is only called on the item view.

Since you copied HTML from the item view into the category view (itemlist), you have 2 options here:

- Either use some other JS modal/popup script already loaded by your template (I see PrettyPhoto loaded), in which you simply need to add some CSS class on the <a> link that has the full image path on.

- Or add the following snippet inside your category.php override, at the very top of the file, but right after the "defined('_JEXEC')..." line:
$document = JFactory::getDocument();
$document->addStyleSheet('https://cdn.jsdelivr.net/npm/[email protected]/dist/magnific-popup.min.css');
$document->addStyleDeclaration('
    /* K2 - Magnific Popup Overrides */
    .mfp-iframe-holder {padding:10px;}
    .mfp-iframe-holder .mfp-content {max-width:100%;width:100%;height:100%;}
    .mfp-iframe-scaler iframe {background:#fff;padding:10px;box-sizing:border-box;box-shadow:none;}
');
$document->addScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.magnific-popup.min.js');

This will trigger Magnific Popup for the category view as well.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Rober636
  • Rober636's Avatar Topic Author
  • Offline
  • New Member
More
3 months 3 weeks ago - 3 months 3 weeks ago #175144 by Rober636
Replied by Rober636 on topic Image modal problem
SOLVED!!!!!!

Thanks!
Last edit: 3 months 3 weeks ago by Rober636.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 months 3 weeks ago #175145 by Fotis
Replied by Fotis on topic Image modal problem
You're welcome.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum