Skip to content

Instantly share code, notes, and snippets.

@megabayt
Last active November 24, 2017 09:53
Show Gist options
  • Save megabayt/96906da76628e2d5ac279f663689f2ec to your computer and use it in GitHub Desktop.
Save megabayt/96906da76628e2d5ac279f663689f2ec to your computer and use it in GitHub Desktop.
custom items magnific
//magnific-popup
$(document).ready(function () {
$('div.big-image').click(function (e) {
e.preventDefault();
var items = [];
var active;
$('.thumbnails img').each(function(i, item) {
if ($(item).hasClass('selected')) {active = i};
items.push({
src: $(item).attr('src')
})
});
items = items.slice(active).concat(items.slice(0, active));
$.magnificPopup.open({
type: 'image',
items: items,
gallery: {
enabled: true
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment