Last active
November 24, 2017 09:53
-
-
Save megabayt/96906da76628e2d5ac279f663689f2ec to your computer and use it in GitHub Desktop.
custom items magnific
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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