Problems with Fancybox: repostioning fancybox, close

I am trying to position a fancybox next to it with a trigger element with beforeShow: function() . He does not work.

I am also trying to close fancybox on hover out . Using $.fancybox.close(); This is a hover over opening, but not a hover out closing. I am trying to get a hover out to work with both a trigger element and fancybox.

Here's the html:

 <a class="fancybox-effects-e" width="300" height="250" href="page.html" title="<b>Title: </b>Lorem ipsum dolor sit amet, consectetur adipiscing elit"><img src="assets/imgs/web/2.jpg" alt="" /></a> 

Here is my JS:

 $("a.fancybox-effects-e").fancybox({ beforeShow: function(){ var position = this.element.offset(); $("a.fancybox-effects-e")._getPosition = function() { return position; } console.log("position = " + position); this.width = $(this.element).data("width"); this.height = $(this.element).data("height"); }, frameWidth : '100%', frameHeight : '100%', fitToView: false, autosize: false, overlayShow : false, /* wrapCSS : 'fancybox-custom', */ closeClick : true, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', autoCenter: false, closeSpeed : 10, type:'iframe', helpers : { title : { type : 'inside' } }} ) .hover(function () { $(this).click(); }, function(){ $.fancybox.close(); }); 
+2
source share

Source: https://habr.com/ru/post/1379222/


All Articles