开发者

Link Within Title Attribute

I noticed that a lot of users were having the same issue, trying to get a link within one of the title attributes within the lightbox, ColorBox.

What I'm trying to accomplish is to have the title for one of the pictures in the grouped gallery that says something like:

"My website: Click <a href:"http://thompson-mcclellan.com"
target="_blank">Here</a>"

for one of the pictures within my grouped gallery. But nothing shows up whenever I try to code it as you stated in the discussion post above.

Here is my JQuery开发者_如何学编程:

$("a[rel='portfolio'] #tmc").colorbox({title:'Click <a
href="http://thompson-mcclellan.com">Here</a>'});

Here is my HTML:

<a id="tmc" href="images/portfolio/tmc.jpg" rel="portfolio"><img
src="images/portfolio/tmc_thumb.jpg" alt="" /></a>

Here is my example website: http://abrielshipley.com/portfolio/index.html


First of all, in your example page the id tmc is applied on the a tag and not on something inside it. So our selector is wrong. Just use $('#tmc').

As far as the colorbox now, the title should be a function that returns the text to display, not a static string.

So

$("#tmc").colorbox({
     title: function() { 
               return 'Click <a href="http://thompson-mcclellan.com">Here</a>';
            } 
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜