Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events for Triggering Next and Prev Event #7

Open
patrickbaber opened this issue Sep 12, 2014 · 0 comments
Open

Events for Triggering Next and Prev Event #7

patrickbaber opened this issue Sep 12, 2014 · 0 comments
Labels

Comments

@patrickbaber
Copy link

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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants