| 1 |
jQuery(document).ready(function($){ |
| 2 |
|
| 3 |
/* Start Image gallery |
| 4 |
* use css/blueimp-gallery.min.css |
| 5 |
* use js/blueimp-gallery.min.js |
| 6 |
* Site https://github.com/blueimp/Gallery/blob/master/README.md#setup |
| 7 |
*/ |
| 8 |
if(!$('#blueimp-gallery').length){ |
| 9 |
$('body').append('<div id="blueimp-gallery" class="blueimp-gallery">\n\ |
| 10 |
<div class="slides"></div>\n\ |
| 11 |
<h3 class="title"></h3>\n\ |
| 12 |
<div class="description"></div>\n\ |
| 13 |
<a class="prev">‹</a>\n\ |
| 14 |
<a class="next">›</a>\n\ |
| 15 |
<a class="close">×</a>\n\ |
| 16 |
<a class="play-pause"></a>\n\ |
| 17 |
<ol class="indicator"></ol>\n\ |
| 18 |
</div>') |
| 19 |
} |
| 20 |
|
| 21 |
/* images gellary for listing preview images */ |
| 22 |
$('.wdk_js_gallery').each(function(){ |
| 23 |
var gallery = $(this) |
| 24 |
|
| 25 |
if(gallery.find('.slick-slider').length) { |
| 26 |
gallery = gallery.find('.slick-slider .slick-slide:not(.slick-cloned)') |
| 27 |
} |
| 28 |
|
| 29 |
gallery.find('.wdk-listing-image-card:not(.skip)').on('dragstart', function (e) { |
| 30 |
e.preventDefault(); |
| 31 |
$(this).data('dragging', true); |
| 32 |
}).on("click", function(e) |
| 33 |
{ |
| 34 |
e.preventDefault(); |
| 35 |
|
| 36 |
if ($(this).data('dragging')) { |
| 37 |
$(this).data('dragging', false); |
| 38 |
return false; |
| 39 |
} |
| 40 |
|
| 41 |
var myLinks = new Array(); |
| 42 |
var current = $(this).attr('href') || ''; |
| 43 |
if($(this).attr('data-fullsrc')){ |
| 44 |
current = $(this).attr('data-fullsrc'); |
| 45 |
} else if($(this).attr('src')) { |
| 46 |
current = $(this).attr('src'); |
| 47 |
} |
| 48 |
|
| 49 |
if(current == '') { |
| 50 |
if($(this).find('img,video').attr('data-fullsrc')){ |
| 51 |
current = $(this).find('img,video').attr('data-fullsrc'); |
| 52 |
} else { |
| 53 |
current = $(this).find('img,video').attr('src'); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
var curIndex = 0; |
| 58 |
gallery.find('img,video').each(function (i) { |
| 59 |
var img_href = ''; |
| 60 |
if($(this).attr('data-fullsrc')){ |
| 61 |
img_href = $(this).attr('data-fullsrc'); |
| 62 |
} else { |
| 63 |
img_href = $(this).attr('src'); |
| 64 |
} |
| 65 |
myLinks[i] = new Array(); |
| 66 |
/* Example Title myLinks[i]['title'] = 'test';*/ |
| 67 |
myLinks[i]['href'] = img_href; |
| 68 |
myLinks[i]['thumbnail'] = img_href; |
| 69 |
|
| 70 |
if(current == img_href) |
| 71 |
curIndex = i; |
| 72 |
|
| 73 |
if(img_href.indexOf('.mp4') !=-1 || img_href.indexOf('.flv') !=-1 || img_href.indexOf('.mkv') !=-1 || img_href.indexOf('.avi') !=-1 |
| 74 |
|| img_href.indexOf('.webm') !=-1 || img_href.indexOf('.mov') !=-1) { |
| 75 |
myLinks[i]['type'] = 'video/mp4'; |
| 76 |
} |
| 77 |
}); |
| 78 |
|
| 79 |
var options = {index: curIndex} |
| 80 |
blueimp.Gallery(myLinks, options); |
| 81 |
|
| 82 |
return false; |
| 83 |
}); |
| 84 |
|
| 85 |
}); |
| 86 |
|
| 87 |
}); |