Answer the question
In order to leave comments, you need to log in
How to make Fancybox run on photoframe click?
Good afternoon!
There is a site with pictures and Photoframe 3, on click the callback "onClick" worked and processed fancybox.
if ($('div#fotorama').length>0) {
$.fn.noop = function(){return this};
var fotorama = $('div#fotorama')
, fancy_data = [];
fotorama.find('img').each(function(){
fancy_data.push({href:$(this).data('b')});
});
fotorama.fotorama({
onClick: function(data) {
var fotoramaClasses = fotorama.attr('class');
var fotoramaTouchStyle = fotorama.data('options').touchStyle;
// fancybox manual call
$.fancybox(/*fotorama.data('options').*/fancy_data, {
type: 'image',
index: data.index,
changeFade: 333,
transitionIn: 'elastic',
transitionOut: 'elastic',
padding: 0,
orig: $('.fotorama__wrap', fotorama),
onStart: function(fancybox, i) {
$.extend(fotorama.data('options'), {touchStyle: false});
fotorama
.trigger('showimg', [i, 333])
.removeClass('fotorama_csstransitions')
.find('.fotorama__wrap')
.removeClass('fotorama__wrap_style_touch')
.addClass('fotorama__wrap_style_fade')
.find('.fotorama__frame').not('.fotorama__frame_active')
[fotoramaTouchStyle ? 'fadeTo': 'noop'](0, 0);
},
onClosed: function() {
$.extend(fotorama.data('options'), {touchStyle: fotoramaTouchStyle});
fotorama
.trigger('showimg', [undefined, 0])
.attr({'class': fotoramaClasses})
.find('.fotorama__wrap')
[fotoramaTouchStyle ? 'addClass' : 'removeClass']('fotorama__wrap_style_touch')
[!fotoramaTouchStyle ? 'addClass' : 'removeClass']('fotorama__wrap_style_fade')
.find('.fotorama__frame')
[fotoramaTouchStyle ? 'fadeTo': 'noop'](0, 1);
}
});
// stop fotorama
return false;
}
});
}
Answer the question
In order to leave comments, you need to log in
In version 4, everything is easier.
<div class="fotorama" data-nav="thumbs" data-width="470" data-height="360" data-thumbwidth="111" data-thumbheight="84" data-thumbborderwidth="0" data-thumbmargin="10">
<div class="fotorama__wrap-link" data-img="pic/photo-5.jpg"><a href="pic/photo-5-big.jpg" class="fancybox"></a></div>
<div class="fotorama__wrap-link" data-img="pic/photo-6.jpg"><a href="pic/photo-6-big.jpg" class="fancybox"></a></div>
<div class="fotorama__wrap-link" data-img="pic/photo-7.jpg"><a href="pic/photo-7-big.jpg" class="fancybox"></a></div>
<div class="fotorama__wrap-link" data-img="pic/photo-8.jpg"><a href="pic/photo-8-big.jpg" class="fancybox"></a></div>
</div>
In your script it says ($('div#fotorama') and in the layout class="fotorama" , change the lattice to a dot. so that it is like this ($('div.fotorama')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question