fancybox icon indicating copy to clipboard operation
fancybox copied to clipboard

Loading icon still in the middle of the browser when using custom topRatio

Open petze opened this issue 14 years ago • 5 comments

I noticed that in Version 2 of FancyBox, the loading icon gets not centered in the wrap-container, when you use a different topRatio than 0.5

Change the topRatio to 0.15, and comment the first line in the _afterLoad function -> F.hideLoading(); (just to make sure you see the loading icon). The icon is still in the middle of the browser window, while the fancyBox container is at the top of the window. Shouldn't the loading icon follow the fancyBox window, or is this behavior volitional?

.

petze avatar Jan 26 '12 16:01 petze

Currently loading icon is positioned with the use of CSS positioning as I wanted to avoid extra JS call -

#fancybox-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -21px;
    ...
}

If you really need to set different position, you can change loading method. It is very easy -

$.fancybox.showLoading = function () {
    var pos = { top : 100, left : 100}; // Set custom position, maybe calculate from window height

    F.hideLoading();

    $('<div id="fancybox-loading"></div>').css(pos).click(F.cancel).appendTo('body');
}

(Add code after including fancybox.js)

fancyapps avatar Jan 26 '12 20:01 fancyapps

Ok, this makes sense. Thank you very much.

In a similar way, the 'next' and 'prev' click areas do not only cover the image, but they also extend to the title (at least when you have the title on the outside). I added a new div underneath the title, which helps me display a description to the image. If this description gets too long, the 'next' and 'prev' icons are not over the actual image anymore.

petze avatar Jan 28 '12 09:01 petze

You are right, thanks for noticing and reporting

fancyapps avatar Jan 31 '12 10:01 fancyapps

Hi, I changed a location for navigation arrows in one of the recent commits. Download and try the latest - https://github.com/fancyapps/fancyBox/zipball/master

fancyapps avatar Feb 09 '12 17:02 fancyapps

HI, thank you very much.

petze avatar Feb 10 '12 08:02 petze