html - 在 fullpage.js 中设置部分的高度

标签 html css height fullpage.js

我正在使用 fullPage.js 这听起来可能很笨,但不知道如何将一个部分的高度设置为小于 100%,我尝试使用 .section#section1 在 css 中设置它(例如。height: 80%;),但这没有任何效果......

非常感谢。

最大

最佳答案

同样的问题was answered in the plugin's github issues forum .

This is a FULL PAGE plugin. There's no such option

这不是插件提供的选项。 如果你想做,你需要自己做。可能是在插件呈现后(在 afterRender 回调上)和调整大小后(afterResize)覆盖部分和幻灯片的 height 属性).

您也可以通过添加 CSS 样式来进行尝试,添加如下内容:

#section1,
#section1 .fp-slide,
#section1 .fp-tableCell{
    height: auto !important;
}

更新

现在 fullpage.js 提供了一种方法来创建比视口(viewport)更小的部分(或者在使用 autoScrolling:falsescrollBar:true 时甚至更大。

在每个部分添加类 fp-auto-height 将按规定执行 in the documentation .

更新 2

fp-auto-height 不允许您使用百分比,但有一个扩展可以让您使用百分比。 Offset Sections . 它还允许您在视口(viewport)中间显示部分,显示前一个和下一个部分。

关于html - 在 fullpage.js 中设置部分的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25218100/

相关文章:

php - 添加额外的 HTML 行 : where to put the code?

html - 如何更改 <select> 中 <option> 的文本颜色?

javascript - 多个单选按钮组的事件监听器

css - 适当的 translateZ 与 rotate 的配合

html body 高度问题

javascript - 从特定点缩放 div

jquery - 无法确定在 div 内表内的 td 上使用什么选择器

javascript - CSS 不适用于 IE 7 中动态创建的元素?

html - 使连续多个链接具有相同的动态高度

ios - 在代码中设置 UIWebView 的高度