WordPress.org

Support

Support » Plugins and Hacks » Awesome Filterable Portfolio » Link Image to Page brings up the lightbox instead of going to URL link

Link Image to Page brings up the lightbox instead of going to URL link

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    I am also experiencing the exact same issue as Jewelmint. I am trying to use the portfolio plugin to access documents.

    I am trying to open a document on my network by clicking on the image of the portfolio item instead of the default lightbox appearing with the thumbnail preview of the image. So essentially I would like to replicate the “View Project” link functionality when clicking on the image of the portfolio item

    Every time I left click on the image, the light box opens instead of the file. If I right click and open in new tab, the file opens. How do I get it so that I can left click on the image and it open the file directly?

    Is there any way to get around this? Any help would be greatly appreciated.

    Kind Regards

    Haydn

    esmi

    @esmi

    Forum Moderator

    @breakstay: If you require assistance then, as per the Forum Welcome, please post your own topic.

    @esmi: please can you point out the relevant section to me? I have read that through and cannot see anywhere that states, if you are experiencing the exact same issue as someone, to start an entirely new thread. It definitely states similar, but not exact.

    Sorry, just subscribing to thread as I’d also like to know answer.

    Hi, one way to fix this is remove colorbox from the link. If you open the afp.php file and remove class=”colorbox” from line 1051, this will make the image link open as the projects page rather than color box (assuming the Image link is set to a projects page in the admin section). This is my page: http://flowingstone.co.nz/projects-3/

    As this will be over-written when the plugin is updated, I’ve actually created a copy of the plugin and re-named it so the change won’t be overwritten. I’m not sure if this is the best method for editing plugins though?

    Hope this helps….

    I had the same problem but had critically small time to fix so I made this hack. Note that this is a bad solution, but a solution at least:

    jQuery(function($) {
    	$( document ).ready(function() {
    		// remove lightbox class from external linked images
    		var comp = new RegExp(location.host);
    		$('a').each(function(){
    			if(comp.test($(this).attr('href'))){
    				// a link that contains the current host
    				$(this).addClass("local");
    			}
    			else{
    				// a link that does not contain the current host
    				$(this).removeClass("lightbox").unbind("click").addClass('external').attr('target','_blank');
    			}
    		});
    	});
    });

    This removes the lightbox class from external links and gives them an ‘external’ class. It also unbinds those links from event listeners that might already been hooked on the element. For the links that are local, it only gives them a class of ‘local’.

    The above code handles href=”#” links as external too. Fix below:

    // remove lightbox class from external linked images
    var comp = new RegExp(location.host);
    $('a').each(function(){
    	if(comp.test($(this).attr('href')) || $(this).attr("href") == "#"){
    		// a link that contains the current host
    		$(this).addClass("local");
    	}
    	else{
    		// a link that does not contain the current host
    		$(this).removeClass("lightbox").unbind("click").addClass('external').attr('target','_blank');
    	}
    });
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Link Image to Page brings up the lightbox instead of going to URL link’ is closed to new replies.
Skip to toolbar