bxslider-3 icon indicating copy to clipboard operation
bxslider-3 copied to clipboard

Making the captions box a hyperlink

Open aarondavies opened this issue 12 years ago • 8 comments

I've set the BX slider to use the captions from the title text.

Is there a way of making the captions hyperlinks?

aarondavies avatar May 06 '12 17:05 aarondavies

$(document).ready(function(){ $(".bxslider li").each(function(){ var sLink = $(this).find('a').attr('href'); $(this).find('div').click(function(){ window.location = sLink; }); });

});

harryvancelaw avatar Dec 19 '12 16:12 harryvancelaw

I think I'm missing something here, somewhere within that find('div')...

@aarondavies, can you confirm this worked?

34tth3r1ch avatar Apr 11 '13 22:04 34tth3r1ch

Once you've enabled captions in bxslider settings isn't there a div within the li that contains the caption which you can target?

harryvancelaw avatar Apr 11 '13 23:04 harryvancelaw

Yea. Might be called, "bx-captions" for instance. The provided code snippet does not trigger a hyperlink overlay of that area/div.

34tth3r1ch avatar Apr 11 '13 23:04 34tth3r1ch

It should attach an onclick to that div. I guess you could always regex the div into a link too like below. Have not tested this though. http://pastebin.com/u6ZR8vd7

harryvancelaw avatar Apr 12 '13 01:04 harryvancelaw

Has anyone confirmed if this works?

maplesyrupsucker avatar Sep 17 '13 16:09 maplesyrupsucker

I used a custom link with JS function in it and this is how I solved it... If someone else faces the same problem...

//Make caption clickable $(document).on('click', '.bx-caption', function(){ var func = $( $(this).parent() ).find('a').attr('onclick'); eval(func); });

Only tested in Chrome..

egroj55 avatar May 02 '14 11:05 egroj55

Any update on this?

llahnoraa avatar Aug 18 '15 16:08 llahnoraa