I am currently using fancybox version 2 to display my images when a thumbnail is clicked but I can't seem to get the fancybox to sit in the middle of the viewport, vertically speaking, since horizontally it's fine.
I've tried quite a few things and this is the latest:
CSS
.fancybox-wrap {
position: fixed !important;
top: 50px !important;
}
jQuery
jQuery(document).ready(function() {
$(".fancybox-wrap").css("position", "absolute");
// fancybox initialisation etc
});
$(window).scroll(function() {
$('.fancybox-wrap').css('top', $(this).scrollTop() + "50px");
});
Does anyone have any ideas?
The only thing you need to do is add to website css
And fancybox will position image at the screen center instead of page center.
http://jsfiddle.net/aGhxK/23/
This sets
left
andtop
usingposition: absolute
dinamically:http://jsfiddle.net/aGhxK/1/