Click to preview image in a new window

GK User
Sun Apr 10, 2016 8:39 pm
My website is www . solo - single . com
Override.css is enabled. My joomla version is 3.5.1. My template version is 3.20. My k2 version is 2.6.8.
When you visit a k2 item article and click on the top main image, then the image appears in the same window. I would open the image in a new window with target=_blank.
Example:
if you go here
www. solo-single .com/ informazioni/cookie
and click on the image with the man that is eating a cookie then the image appears in the same window. How can I set "open in a new window"?
User avatar
Expert Boarder

teitbite
Thu Apr 14, 2016 12:04 pm
Hi

Edit file /html/com_k2/tmplates/default/item.php and look for the code where image is added to site. Remove part data-k2-modal="image" and add target="_blank" instead.
User avatar
Moderator

GK User
Thu Apr 14, 2016 3:00 pm
no chance to use override.css?
I would avoid editing php files cause with a new template update I will have to remember and edit them again.
Can't we use .itemImageBlock > a { ... }?
User avatar
Expert Boarder

teitbite
Wed Apr 20, 2016 10:23 am
Hi

CSS doesn't work like this. It cannot add a tag. CSS is only for styling and some minor effects.

You can edit this item.php I've mentioned or add a script to /layout/blocks/head.php which will make it for You.

Code: Select all
<script type="text/javascript">(function($) {$(document).ready(function() {
$('.itemImageBlock a').each(function(){
$(this).removeAttr('data-k2-modal').attr('target','_blank');
});
});})(jQuery)</script>
User avatar
Moderator


cron