简体   繁体   English

Avada WP 主题/Bootstrap Modals 导致页面在移动设备上滚动到顶部

[英]Avada WP Theme / Bootstrap Modals Cause Page to Scroll to Top on Mobile

Using Avada theme and not sure what version of Bootstrap they have integrated, but on mobile when I open a modal it scrolls the page to the top.使用 Avada 主题并且不确定他们集成了哪个版本的 Bootstrap,但是在移动设备上,当我打开一个模式时,它会将页面滚动到顶部。 I've tried a few solutions from the wild, but none have worked so far.我已经尝试了一些野外解决方案,但到目前为止都没有奏效。

I just experienced the same issue on Avada 5.5.2.我刚刚在 Avada 5.5.2 上遇到了同样的问题。 Here is the exact question my coworker emailed me this morning.这是我的同事今天早上给我发电子邮件的确切问题。

I'm working on the *******.com website.我在 *******.com 网站上工作。 The modal windows work as they should on desktop.模态窗口在桌面上正常工作。 However on mobile, when a modal link is clicked the modal window pops up just fine, but it also scrolls the page back to top.但是在移动设备上,当单击模态链接时,模态窗口会弹出得很好,但它也会将页面滚动回顶部。 Avada includes a # in the href line when using these bootstrap functions, and won't let me remove it.使用这些引导函数时,Avada 在 href 行中包含一个 #,并且不会让我删除它。

So, here's what I tried, without success: ....所以,这是我尝试过的,但没有成功:....

After going in a lot of incorrect directions, the solution that worked for me was one simple css tweak.在走了很多不正确的方向之后,对我有用的解决方案是一个简单的 css 调整。 Add the code below labeled "solution" to your child theme, or directly into your Avada Options as done in the screenshot.将下面标记为“解决方案”的代码添加到您的子主题中,或直接添加到您的 Avada 选项中,如屏幕截图所示。

fusion-10.min.css融合-10.min.css

The style sheet fusion builder creates is forcing fixed positioning.样式表融合构建器创建的强制固定定位。

.ua-mobile .modal-open {
    position: fixed;
    overflow: hidden;
}

Solution解决方案

Override the fusion style sheet as such.像这样覆盖融合样式表。

.ua-mobile .modal-open {
    position: relative;
}

在此处输入图片说明

很棒-这对我有用:-)谢谢>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM