View Full Version : Click On Image While Displayed In Main Gallery Opens New Window

12-17-2010, 04:30 AM
For my website, I'm currently using ColorBox to show off my photo gallery on my website:

The one thing I want is for the image being displayed in the gallery clickable so it can lead to the actual website in a new window. I have tried using the onclick=window.open() function in the PHP and in the image tag, but that only causes the website to open at the same time the gallery opens.

Here is the picture I would like to have click to the website in a new window HTML code:

<a href="images/portfolio/tmc.jpg" rel="portfolio" title="Thompson McClellan: Commercial Photographers website design"><img src="images/portfolio/tmc_thumb.jpg" class="tmc" alt="" /></a>

And the PHP/JavaScript:

$("a[rel='portfolio']").colorbox({current: "", width:"75%", height:"75%", title:""});
$('#portfolio_content a[rel="portfolio"]').hover(
function() {
$(this).animate({opacity: 1}, 250);
function() {
$(this).animate({opacity: 0.5}, 250);
).css('opacity', 0.5);
$("a[rel='portfolio'] .tmc").colorbox({href: "http://www.thompson-mcclellan.com"});

Here is the website so far: