Last active
June 17, 2016 09:12
-
-
Save insekticid/80c2597d33a456b26b45980f0e5215ea to your computer and use it in GitHub Desktop.
There is no option how to create clickable image carousel via blueimp gallery, here is my extend @blueimp
This file contains hidden or 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
blueimp.Gallery([ | |
{ | |
title: 'Banana', | |
href: '/img/pictures/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp', | |
type: 'carousel/jpeg', | |
thumbnail: '/img/icons/125x125/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp' | |
}, { | |
title: 'Banana', | |
href: '/img/pictures/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp', | |
type: 'carousel/jpeg', | |
thumbnail: '/img/icons/125x125/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp' | |
}] | |
, | |
{ | |
container: '#carousel-gallery', | |
carousel: true | |
} | |
); |
This file contains hidden or 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
$('[data-gallery-carousel]').each(function() { | |
var items = []; | |
$(this).find('.slides .slide a').each(function (i, el) { | |
items.push({href: $(el).attr('href'), thumbnail: $(el).find('img').attr('src'), type: 'carousel/image'}); | |
}); | |
blueimp.Gallery(items, {container: $(this), carousel: true}); | |
}) |
This file contains hidden or 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
blueimp.Gallery.prototype.carouselFactory = function (obj, callback) { | |
var img = this.imagePrototype.cloneNode(true); | |
img.title=obj.title;var $element = $(img); | |
var playMediaControl = document.createElement('a');playMediaControl.setAttribute('href', obj.href);playMediaControl.setAttribute('data-gallery', obj.gallery);playMediaControl.appendChild(img);$element.on('load error',function(e){e.target = playMediaControl;callback(e)});img.src=obj.thumbnail; | |
return playMediaControl; | |
}; |
This file contains hidden or 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
<div id="carousel-gallery" data-gallery-carousel class="blueimp-gallery blueimp-gallery-carousel blueimp-gallery-display blueimp-gallery-playing blueimp-gallery-controls" data-start-slideshow="true"> | |
<div class="slides"> | |
<div class="slide"> | |
<a href="/img/pictures/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp" data-gallery="#carousel-gallery"> | |
<img src="/img/icons/125x125/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-1_BIG.webp"/></a> | |
</div> | |
<div class="slide"><a href="/img/pictures/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-2_BIG.webp" data-gallery="#carousel-gallery"> | |
<img src="/img/icons/125x125/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-2_BIG.webp"/></a> | |
</div> | |
<div class="slide"><a href="/img/pictures/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-3_BIG.webp" data-gallery="#carousel-gallery"> | |
<img src="/img/icons/125x125/zelenina/zapeceny-lilek-s-kurecim-masem-paprikou-a-kukurici-3_BIG.webp"/></a> | |
</div> | |
</div> | |
<a class="prev">‹</a><a class="next">›</a><a class="play-pause"></a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment