malsup / cycle2

2nd gen cycling
899 stars 236 forks source link

Links on images + overlay + prev/next #214

Open ericcarroll opened 11 years ago

ericcarroll commented 11 years ago

I discovered you can't have links on images and have the data-cycle-desc work in the overlay. It would only print out 'desc' instead of the text listed in the markup OR it would print out both items properly, but remove the linking ability and it would lose the prev/next arrows.

My fix:

  1. Change the data-cycle-slides option to look for the class name of "cycle-link" like this: <div class="cycle-slideshow" data-cycle-slides=".cycle-link">
  2. Add a class name of "cycle-link" to the anchor tag so it now looks like this: <a class="cycle-link" data-cycle-title="Your Overlay Title" data-cycle-desc="Your Overlay Description">

Note: make certain to put the data-cycle-title and data-cycle-desc on the anchor tag and not the image tag. It should look like this: <a href="your-url" class="cycle-link" data-cycle-title="Overlay Title" data-cycle-desc="Overlay Description"><img src="" /></a>

ruraldreams commented 11 years ago

I was having the same problem, but I don't think it is related to a link per se - the caption data just needed to be applied to the element specified by data-cycle-slides. In my case it's a div. Thank you for posting this, I've been struggling with it for hours.

ericcarroll commented 11 years ago

I hope it was helpful. It stinks to feel like you've been spinning your wheels for hours though.

mwordpress commented 10 years ago

nice job work for me thank you

nwoodward commented 10 years ago

I struggled with this for awhile. Thanks for posting your solution!

Jawanet commented 10 years ago

why loading ?