EKGECG
EKGECG

Reputation: 21

Fancybox opens further down the page after page was scrolled

I have a page which uses fancybox to display a series of images. When I scroll the page down to view the entire image and then hit next to move to the next image, the new box/image opens further down than the vertical center of the viewport (in fact multiple number of points down compared to the amount of scroll). As I keep doing this for every succesive image I find myself ways down the top of the page on the last image...

How do we force each succesive box to open a fixed amount of distance from the very top of the page (even if paged was scrolled down). Would this involve modifying the js file iteself (e.g., viewport function?).

Many thanks!

Upvotes: 2

Views: 1455

Answers (1)

nd2010
nd2010

Reputation: 119

There is a centerOnScroll parameter which should solve your issue. See jQuery FancyBox : fixed position of popup with respect to window while scrolling

Example:

    $("#LinkName").fancybox({
        'hideOnContentClick': true,
        'autoScale': true,
        'height': 'auto',
        'scrolling': 'no',
        'transitionIn': 'none',
        'transitionOut': 'none',
        'centerOnScroll': true
    }).click();

Upvotes: 1

Related Questions