Skip to content

Instantly share code, notes, and snippets.

@xfenix
Created May 21, 2012 21:25
Show Gist options
  • Save xfenix/2764829 to your computer and use it in GitHub Desktop.
Save xfenix/2764829 to your computer and use it in GitHub Desktop.
Shadowbox next/prev lightbox-like navigation implementation
Shadowbox.init({
onFinish : function(az) {
var navBtnRight = $("<div/>").addClass('shadowbox-nav shadowbox-next').html($("<a/>") .click(function(){Shadowbox.next();}));
var navBtnLeft = $("<div/>").addClass('shadowbox-nav shadowbox-prev').html($("<a/>").click(function(){Shadowbox.previous();}));
$("#sb-body-inner").prepend(navBtnRight )
.prepend(navBtnLeft);
$('.shadowbox-nav').hover(
function() {
if(
( $(this).hasClass('shadowbox-next') && !Shadowbox.hasNext() )
||
( $(this).hasClass('shadowbox-prev') && Shadowbox.current == 0 )
)
return true;
$(this).find('a').fadeIn();
},
function() {
$(this).find('a').fadeOut();
}
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment