jquery-fullsizable
jquery-fullsizable copied to clipboard
Events for Triggering Next and Prev Event
There is an easy way to add captions with the event "fullsizable:opened" to the plugin, but after that it is really tough to hook into the prev and next buttons and change the caption. With new events for prev/next and a link parameter, which returns the corresponding link element, like "fullsizable:opened" event it would be easy to handle.
Here is my workaround for the caption.
HTML:
<a href="foo.jpg" class="fullsizable" data-caption="My Caption"></a>
JavaScript:
$(document).on('fullsizable:opened', function(e, link) {
var $link = $(link),
captionText = $link.data('caption');
//create markup if necessary
if (!$('#fullsized_caption').length) {
var caption = '<div id="fullsized_caption" class="fullsized__caption"/>' +
$('#jquery-fullsizable').append(caption);
}
//update info in container
$('#fullsized_caption').text(captionText);
});