Add HREF URL to button that is placed on top of jQuery cycle slider for the active slider image -


i have slider i've added controls on top of slider, normal next & previous ::: additionally want add button when clicked on open image in full view (lightbox) ::: code below populate button's href seems out of sync current image being displayed ::: don't have enough knowledge of jquery bottom of ::: appreciate assistance :::

$('.portfolio-slider').hover(function() { $('.portfolio-controls').fadein(); }, function() { $('.portfolio-controls').fadeout(); });  $('.portfolio-slider .slides').cycle({ timeout: 2000,  fx: 'fade', prev : '.prev-slide',  next : '.next-slide',  pause: 1, after: onafter });  function onafter(currslideelement) { $('#full-size-button').attr('href', $('a', currslideelement).attr('href')); } 

why not have button opens large version of image grab current image when clicked, rather function runs after transition:

<a id="full-size-button">view bigger image</a>  $('#full-size-button').live('click', function() {     $('#full-size-button').attr('href', $('.portfolio-slider img').is(':visible').attr('href')); }); 

note: selector visible image may need tweaked depending on html structure.

----edit----

i noticed in jquery cycle docs may want use current code callback function "before" rather "after":

before: transition callback (scope set element shown) after: transition callback (scope set element shown) 

if use before callback information set next slide link open current image.

http://jquery.malsup.com/cycle/options.html


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -