Fancybox inline popup on mobile not moving with page scroll

不羁岁月 提交于 2019-12-25 14:11:29

问题


I am working on this website: http://www.fairfaxandroberts.com.au/

And I am using fancybox for inline popup: http://fancyapps.com/fancybox/

When you visit the site you can see the popup that is shown down below the instagram feed when you scroll.

On desktop and larger version it is working well, but on mobile versions the popup is shown when you scroll below insta feed, but it stays on the position where it is shown, it doesn't move with the page scroll behind.

The jQuery code I use to display Fancybox is this:

                    $(window).scroll(function() {
                        var y = $(window).scrollTop();
                        var insta_feed_top = $("#slide-55").offset().top;
                        if (y > insta_feed_top) {
                        $(window).off('scroll');
                        $(".fancybox_newsletter")
                            .fancybox({
                                helpers: {
                                    overlay: {
                                      locked: false
                                     }
                                 }
                                }).trigger('click');                              
                        }

                    });

What can be the issue guys? I tried a lot, saw the documentation on the site, but nothing works.


回答1:


[SOLUTION]

Guys after debugging on the mobile, I found that the position was changing on absolute for mobile devices. I just changed the position to be fixed, added some top and left margin and everything looks perfect.

Thanks again.



来源:https://stackoverflow.com/questions/31904383/fancybox-inline-popup-on-mobile-not-moving-with-page-scroll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!