Magnific Popup
I use Magnific Popup, a jQuery lightbox like plugin. I try to use the built in object to get an attribute.
It does not work the way I thought it would. I've read the API here:
http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
What I tried so far
I get the object in the console but I can't get an attribute from it. (the jquery ready looks a bit different (alias) because it's used in WordPress)
<script>
jQuery(document).ready(function($) {
$('.image-link').magnificPopup({
type:'image',
callbacks: {
open: function() {
var magnificPopup = $.magnificPopup.instance;
console.log(magnificPopup.currItem);
window.location.hash = $(magnificPopup.currItem).attr('data-slug');
}
}
});
});
</script>
<a href="http://www.someimage.com/image.png" data-slug="my-slug">
Own thougts
- This is not an object like $(this) and will not work the same?
- I call it the wrong way?
- I use the wrong object for this problem?
Question
How is it done correctly?