var QueryString = function () { var query_string = {}; var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i 0) { var li = figure.closest('li'); if (li.length > 0 && li.prev().length > 0) { var newFigure = li.prev().children('figure'); loadFigure(newFigure); } } }); $('.move-next').click(function(){ var id = $('#showModel p[data-photo-id]').data('photo-id'); var figure = $('figure[data-photo-id="'+id+'"]'); if (figure.length > 0) { var li = figure.closest('li'); if (li.length > 0 && li.next().length > 0) { var newFigure = li.next().children('figure'); loadFigure(newFigure); } } }); $('figure[data-reveal-id="showModel"]').click(function(){ loadFigure($(this)); }); $('#showModel .show-info').click(function(){ $(this).toggleClass('active'); if ($(this).hasClass('active')) { $('#showModel p[data-photo-id], #showModel .look-cntrl').addClass('active'); } else { $('#showModel p[data-photo-id], #showModel .look-cntrl').removeClass('active'); } }); $('#showModel').click(function(e){ var el = $(e.target); if (!el.is('img') && !el.is('.datawrapper') && el.closest('.datawrapper').length == 0) { $('.reveal-modal-bg')[0].click(); } }); $('.reveal-modal-bg').click(function(){ if (document.body.clientWidth <= 1024) { //$('body').removeClass('modal-open'); } else { $('.reveal-modal-bg').fadeOut(); } }); if (document.body.clientWidth <= 1024) { $(document).on('close.fndtn.reveal', '[data-reveal]', function () { $('body').removeClass('modal-open'); $('.reveal-modal-bg').fadeOut(); }); } function loadFigure(figure){ var curIndex = figure.closest('li').index() + 1; $('#showModel .look-current').html(curIndex); var img = figure.children('img').clone(); $('#showModel .imgwrapper .zoom img').remove(); $('#showModel .imgwrapper .zoom').append(img); var info = '

'+$('#showModel .look-cntrl h2').clone().html(); figure.find('.metainfo').each(function(){ info += ''+$(this).data('name')+':
'+$(this).data('articul')+'
'+$(this).data('size')+'
'; }); info += '

'; $('#showModel p[data-photo-id]').replaceWith(info); if ($('#showModel .show-info').hasClass('active')) { $('#showModel p[data-photo-id]').addClass('active'); } $('.reveal-modal-bg').fadeIn(); if (document.body.clientWidth <= 1024) { $('body').addClass('modal-open'); setTimeout(function(){$('#showModel').css('top', 0);}, 400); } swipedetect(img[0], function(dir){ if (dir == 'right') { $('.move-prev').trigger('click'); } else if (dir == 'left') { $('.move-next').trigger('click'); } }); $("#ex3").zoom(); } $("#ex3").on("click", function(){ $(this).toggleClass("out"); });