Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make fancybox appear on top

I have set up a link to an image using fancybox but when I click on the thumbnail the fancybox box appears behind all my content. I have been using z-index to place other content in the page so I think I need to do the same for the fancybox but I don't know where to place the css code?

like image 659
Jordan Avatar asked Apr 14 '11 23:04

Jordan


People also ask

How do I open Fancybox on button click?

jQuery(document). ready(function($) { $('button'). on('click', function() { $. fancybox(); }); });

How do I close a fancybox after submitting?

You can close it with $. fancybox. close() .

How do I add Fancybox to Magento 2?

The first step, of course, is to download the latest version of Fancybox (version 3) from their website and unzipping it. Within the myriad of folders you will find one called dist, and within that you will find four files – the CSS file (and a minified version) and the JS file (and a minified version.


3 Answers

Fancybox has it's own CSS file, and you should look for #fancybox-wrap and change it's z-index'es there. But anyways, it has pretty high setting by default (1101 on mine), therefore I'd suggest altering your own HTML/CSS.

Just in case, check if you have added that fancybox stylesheet in your HTML.

like image 168
tomsseisums Avatar answered Oct 10 '22 06:10

tomsseisums


I've addded:

.fancybox-overlay {
    z-index: 1000000 !important;
}

in my stylesheet for recent version of fancybox.

like image 43
wmwmwm Avatar answered Oct 10 '22 06:10

wmwmwm


In my case, using WordPress 4.1 and Fancybox plugin, I solved the problem adding this CSS rule:

div#fancy_outer {
z-index: 1000000;
}
like image 30
DonBeto97 Avatar answered Oct 10 '22 08:10

DonBeto97