简体   繁体   English

窗口调整大小后,fullpage.js仅会滚动溢出

[英]fullpage.js will only scrollOverflow after window resize

I have a fullpage.js site setup here . 在这里有一个fullpage.js网站设置。 The first section has no scrollOverflow, but the second section is a grid (generated using gridify), which requires (on certain screen sizes), for it to be a scrollable section. 第一部分没有scrollOverflow,但是第二部分是一个网格(使用gridify生成),需要(在某些屏幕尺寸上)它才能成为可滚动部分。

The problem is it refuses to scroll. 问题是它拒绝滚动。 However, if I resize the window (even by a single pixel in any direction), then the fullpage.js scrollbar will appear for that section. 但是,如果我调整窗口的大小(即使在任何方向上都按单个像素调整大小),则针对该部分将显示fullpage.js滚动条。

Does anyone have any idea why fullpage.js is acting this way? 有谁知道为什么fullpage.js是这样工作的? And how can I get the scrollbar to appear in that section without having the resize the window manually? 以及如何使滚动条显示在该部分中而无需手动调整窗口大小?

It's worth noting, I've been able to get the same thing working using the fullpage.js example page for scrollOverflow. 值得一提的是,我已经使用scrolloverflow的fullpage.js示例页面获得了同样的效果。 That is setup right here . 那就是这里的设置。 However, I haven't been able to figure out why it works there, but not in my original page! 但是,我无法弄清楚它为什么能在这里工作,但无法在我的原始页面中找到!

That's probably because the content of your section or slide is being generated (or modified somehow) after fullPage.js gets initialized. 这可能是因为在初始化fullPage.js之后会生成(或以某种方式修改)您的部分或幻灯片的内容。

You should have used that javascript code inside the afterRender callback as fullPage.js documentation details : 您应该在afterRender回调内使用该javascript代码作为fullPage.js文档详细信息

afterRender() afterRender()

This callback is fired just after the structure of the page is generated. 页面结构生成后立即触发此回调。 This is the callback you want to use to initialize other plugins or fire any code which requires the document to be ready (as this plugin modifies the DOM to create the resulting structure). 这是您要用来初始化其他插件或触发任何需要准备文档的代码的回调 (因为此插件修改DOM来创建结果结构)。

In any case, I believe you can solve it by calling the method reBuild provided by fullPage.js. 无论如何,我相信您可以通过调用reBuild提供的reBuild方法来解决。 You can try to use it in the afterRender callback or directly after the code you use to generate the layout/content of the section to which you want to apply the scrollOverflow option. 您可以尝试在afterRender回调中使用它,或者直接在用于生成您要对其应用scrollOverflow选项的节的布局/内容的代码之后使用它。

$('#fullpage').fullpage({
    //your options
});

//code used to generate the content of your section 
//...

//re-building fullPage.js to detect the current content of each section
$.fn.fullpage.reBuild();

If that doesn't work, you can always try to use a timeout which should also solve it with some delay: 如果这不起作用,您可以随时尝试使用超时,这也应该延迟解决:

setTimeout(function(){
    $.fn.fullpage.reBuild();
}, 1000);

暂无
暂无

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

相关问题 scrollOverflow / slimScroll在fullPage.js中无法正常工作 - scrollOverflow / slimScroll not working properly in fullPage.js 使用Fullpage.js和scrolloverflow.js禁用内容链接 - Disabled Content Links with Fullpage.js and scrolloverflow.js 使用Scrolloverflow.js + Fullpage.js包装的内容 - Work with content wrapped with Scrolloverflow.js + Fullpage.js fullpage.js - 在mobile上设置responsiveWidth和scrollOverflow中断页面 - fullpage.js - setting responsiveWidth and scrollOverflow breaks page on mobile FullPage.js scrollOverflow无法正确处理加载的内容 - FullPage.js scrollOverflow not working properly with loaded content Fullpage.js:我可以使用哪个功能重新启动ScrollOverflow插件? - Fullpage.js: with which function I can restart the ScrollOverflow plugin? 与 fullPage.js 兼容的 JS 图像调整大小 - JS image resize compatible with fullPage.js 无法在移动设备上使用fullpage.js在scrollable部分下方的overflow:auto元素进行交互,scrollOverflow:true - Can't interact on mobile with overflow:auto element underneath scrollable section using fullpage.js, scrollOverflow:true fullpage.js-如果'scrolloverflow'设置为true,则无法向下滚动到下一部分 - fullpage.js - If 'scrolloverflow' is set to true can't scroll down to the next section 固定的标题块,在带有“ scrollOverflow:true”的fullPage.js节中滚动 - Fixed Header Blocks Scrolling through fullPage.js Sections with “scrollOverflow: true”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM