问题
I'm using jquery and fancyBox (may be replaced if you suggest).
My goal is to create a popup gallery with next/prev buttons, but images must be shown grouped by two, just like paper book.
I can easily show fancyBox popup and it works fine.
$.fancybox( ['image.jpg', 'image.jpg'] );
But, where should i look to display pages by two? I believe I should write some plugin for fancyBox. Or maybe you can offer another way.
回答1:
While it is not possible to display two photos out of the box, keep in mind that fancyBox can display any html code! That means, you could "build" a book by some other script or by yourself and then simply call fancybox manually:
$('#start-photo-book').on('click', function() {
var book = [];
$.each( $("#photo-book").children(), function( key, value ) {
book.push({
content : $( value ).clone(),
type : 'html'
})
});
$.fancybox.open( book, {
loop : false,
smallBtn : false
});
});
See this demo:
http://codepen.io/fancyapps/full/OWObor/
来源:https://stackoverflow.com/questions/41507080/two-page-view-with-jquery-fancybox