fancybox icon indicating copy to clipboard operation
fancybox copied to clipboard

Opening overlay manually

Open christian-schwan opened this issue 14 years ago • 16 comments

He,

after closing the site is jumping back to the top.

Why do you set the body to overflow hidden?

fancybox.showLoading() is not showing the overlay. We need this for eCommerce add to Cart function.

We already tried to put the request to beforeLoad function but that doesn't work.

Thx

christian-schwan avatar Oct 01 '12 14:10 christian-schwan

If you open http://fancyapps.com/fancybox/#examples - is the site jumping to the top? Are you experiencing any "closing bug"? Yes/No? If no, then, obviously, there is something wrong with your site.

It is not currently possible to manually open/close overlay.

fancyapps avatar Oct 01 '12 14:10 fancyapps

it's my fault. how much work will it be to open the overlay with the showLoading function? We can donat the money for that feature.

christian-schwan avatar Oct 01 '12 14:10 christian-schwan

I`ll give it a try.

fancyapps avatar Oct 01 '12 17:10 fancyapps

Btw, are you suing the latest version? fancyBox recently started to display overlay on load.

fancyapps avatar Oct 04 '12 18:10 fancyapps

hey thx I see you added in the helpers onReady function, can you explain how to use this? I have to show the the overlay before calling the showLoading API function

christian-schwan avatar Oct 05 '12 16:10 christian-schwan

It is now (since v2.1.2) possible to open and close overlay manually -

// Open using default options
$.fancybox.helpers.overlay.open();
// Pass custom options
$.fancybox.helpers.overlay.open({closeClick : false});
// Close
$.fancybox.helpers.overlay.close();

fancyapps avatar Oct 15 '12 14:10 fancyapps

Hi !

I'm using fancybox v2.1.5 and would like to use the fancybox overlay screen while loading items in ajax and therefor trigger it manually.

I was glad to find that someone else asked for the same thing and that this issue was fixed, but it seems that in v2.1.5, the overlay doesn't shows up anymore this way. I've tried the code above, and the showLoading function (but this only display the animated icon and not the overlay)

Am I doing something wrong or is there another way to trigger (and hide) both overlay and icon ?

Thx in advance (and a really great thx for fancybox script !!)

elcibi avatar Sep 15 '13 16:09 elcibi

Open/close overlay:

$.fancybox.helpers.overlay.open();
$.fancybox.helpers.overlay.close();

Show/hide loading icon:

$.fancybox.showLoading();
$.fancybox.hideLoading();

fancyapps avatar Sep 15 '13 16:09 fancyapps

Hi !

Thx for your fast answer.

That's the code I've used, but overlay doesn't appears.

I've check on demo site and found differences between the fancybox.jquery.js scripts available in the 2.1.5 package from github (v1) and the one available on jsfiddle/fancyapps.com (v2).

$.fancybox.helpers.overlay.open() only works with v2.

Kind regards

Edit :

Difference is in here :

V1 : this.overlay = $('

').appendTo( F.coming ? F.coming.parent : opts.parent );

V2 parent = F.coming ? F.coming.parent : opts.parent; this.overlay = $('

').appendTo( parent && parent.lenth ? parent : 'body' );

There is no more test to check if " opts.parent " exists and switch to body tag if it doesn't :)

elcibi avatar Sep 15 '13 19:09 elcibi

I was experiencing the same issue. If you alert(F.coming ? F.coming.parent : opts.parent ) you will see that there is nothing to appendTo. So define a parent.

$.fancybox.helpers.overlay.open({parent: 'body'});

ka9ben avatar Oct 12 '13 09:10 ka9ben

For me, $.fancybox.helpers.overlay.open({parent: 'body'}); doesn't work, but $.fancybox.helpers.overlay.open({parent: $('body')}); yes

jeremypetrequin avatar Oct 15 '13 14:10 jeremypetrequin

According to the Jquery appendTo() specification, both ({parent: 'body'} and $('body')) should work.

ka9ben avatar Oct 15 '13 15:10 ka9ben

Oh yes sorry, just checked my previous code and I had another mistake!

jeremypetrequin avatar Oct 15 '13 15:10 jeremypetrequin

$.fancybox.helpers.overlay.open({parent: $('body')}); worked for me. Thanks Guys

ghost avatar Jan 22 '15 05:01 ghost

.fancybox.helpers.overlay.open({parent: $('body')}); Yes, it works very well. Thanks.

ghost avatar Jul 19 '16 15:07 ghost

.fancybox.helpers.overlay.open({parent: $('body')}); Yes, it works very well. +1 I am looking for same

aadilhussain avatar Mar 22 '17 15:03 aadilhussain