javascriptjqueryfancyboxjcarousellite

jCarouselLite and fancybox popup


I am using jCarouselLite and fancybox together, please see this link

http://travianstation.com/index.html

script: http://travianstation.com/scripts/script.js

If you click on "Gallery" without scrolling down, Gallery will poup on correct positions but if scroll down and then click on Gallery they are not in center of windows and second images row come above the large image.

Kindly can someone guide me how to fix this issue. Thanks


Solution

  • Inside your script.js file you have this piece of code

    $().ready(function() {
     var $scrollingDiv = $("#fancybox-contentB");
     var $scrollingDivB = $("#fancybox-content");
     $(window).scroll(function(){                   
       $scrollingDiv.stop().animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow");            
       $scrollingDivB.stop().animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow");           
     });
    });
    

    that I suspect is adding dynamically 30px to the marginTop of the #fancybox-content for each little inch you scroll down the window, pushing it literally down out of the screen (try to scroll down continuously the window while fancybox is opened to see the effect.)

    What is the idea of having this function?