Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position Fancybox 2 manually

I can not for the life of me, figure out how I can reposition Fancybox 2 to use left: 47px; and top: 147px

I read through the source code, and without hacking it, I don't see a way to override the positioning.

Setting autoCenter to false only stops auto-centering after the first time it does it.

Using jQuery to change the CSS, or giving a custom wrapper to apply the CSS doesn't work either, because Fancybox always adds inline CSS which overwrites all my attempts.

Is there a way to tell Fancybox to stop positioning itself and to use my absolute positioning?

like image 550
bafromca Avatar asked Mar 29 '12 19:03

bafromca


People also ask

How do I open Fancybox on button click?

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


1 Answers

You can override inline CSS styles using the !important modifier.

For the Fancybox use case the following will override the JavaScript positioning:

.fancybox-wrap { 
  top: 147px !important; 
  left: 47px !important; 
}
like image 104
leepowers Avatar answered Oct 16 '22 04:10

leepowers