Fancybox问题:重新设置fancybox,关闭时将其hover

我正在尝试使用beforeShow: function()将fancybox beforeShow: function()在它的触发元素附近。 它不起作用。

我也试图on hover out关闭fancybox。 使用$.fancybox.close(); 它在hover over打开但不会在hover out关闭。 我试图将hover out在触发元素和fancybox上。

这是html:

 <a class="fancybox-effects-e" width="300" height="250" href="https://stackoverflow.com/questions/30795727/fancybox-issues-repostioning-fancybox-close-on-hover-out/page.html" title="Title: Lorem ipsum dolor sit amet, consectetur adipiscing elit"> 

这是我的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(); });