At first, I post this issue for FancyBox issue tracker, but FancyBox owner closed issue without solve.
1. Summary
I click to image → make some actions in FancyBox menu (run slideshow for example):
page scroll to top.
I have this behavior for Gemini scrollbar and no reproduce for native browser scrollbars.
I don't reproduce a bug for browsers native scrollbar.
2. Environment
2.1. Scripts
- JQuery 3.3.1
- FancyBox 3.5.6
- Gemini Scrollbar 1.5.3
- JQuery Lazy 1.7.10
2.2. Tested browsers
I reproduce the problems in browsers versions without addons and users settings:
- Firefox 65.0 (64-bit)
- Chrome 71.0.3578.98 (Official Build) (64-bit)
2.3. Screencast writing
- ScreenToGIF 2.16
- LiceCAP 1.28
- ActivePresenter Free 7.5.4
I post this information, because I have strange behavior.
If I record GIF:
problem not reproduced. I can record GIF from about tenth attempt.
Else:
problem reproduced quickly, almost immediately after the start of the FancyBox slideshow.
3. MCVE
(Yes, it minimal example)
4. Steps to reproduce
I open my demo page → I scroll page to any image → I run FancyBox slideshow.
5. Expected behavior
If default scrollbar:
no scrolling to top of page.
See examples here and here.
6. Non-expected behavior
Else Gemini scrollbar:
scrolling to page top. See GIF from MCVE for example.
7. Not helped
I read many similar questions → try solutions from answers and comments → no effect.
-
$.fancybox.defaults.hideScrollbar = false;
as @fancyapps say
-
$.fancybox.defaults.autoFocus = false;
as @fancyapps say
-
Dave Kiss most popular Stack Overflow answer
-
@sohel-ahmed-ansari variant
-
@theexpand and @hsobhy variants
-
@Joeran answer. I try modified it to Gemini methods → also no effect.
$('.KiraNotLazy').fancybox({
beforeLoad: function(){
internals.scrollbar.destroy();
},
afterClose: function(){
internals.scrollbar.update();
}
});
Thanks.