调整浏览器全页 js 大小时消除延迟
Remove delay when resizing browser fullpage js
我不知道 jquery 或 javascript 我已经尽我所能修改了它,我想要完成的是当你在全屏模式下缩小或打开浏览器时缩小或变为全浏览器大小时,内容和高度会出现延迟 我想弄清楚如何消除该延迟
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'],
navigation: true,
navigationPosition: 'right',
});
});
html {
text-rendering: optimizeLegibility;
height: 100%;
}
body {
height: 100%;
padding: 0px;
margin: 0px;
overflow: hidden;
background: #e6e6e6;
font-family: roboto, sans-serif;
font-weight: 400;
color: #777777;
line-height: 24px;
font-size: 16px;
}
html.fp-enabled,
.fp-enabled body {
margin: 0;
padding: 0;
overflow: hidden;
/*Avoid flicker on slides transitions for mobile phones #336 */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.fp-section {
position: relative;
-webkit-box-sizing: border-box;
/* Safari<=5 Android<=3 */
-moz-box-sizing: border-box;
/* <=28 */
box-sizing: border-box;
}
.fp-section.fp-table {
display: table;
table-layout: fixed;
width: 100%;
}
.fp-tableCell {
display: table-cell;
vertical-align: middle;
width: 100%;
height: 100vh;
}
.fp-scrollable {
overflow: hidden;
position: relative;
}
.fp-scroller {
overflow: hidden;
}
.iScrollIndicator {
border: 0 !important;
}
.fp-notransition {
-webkit-transition: none !important;
transition: none !important;
}
#fp-nav {
position: fixed;
z-index: 100;
margin-top: -32px;
top: 50%;
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
}
#fp-nav.right {
right: 17px;
}
#fp-nav ul {
margin: 0;
padding: 0;
}
#fp-nav ul li {
display: block;
width: 14px;
height: 13px;
margin: 7px;
position: relative;
}
#fp-nav ul li a {
display: block;
position: relative;
z-index: 1;
width: 100%;
height: 100%;
cursor: pointer;
text-decoration: none;
}
#fp-nav ul li a.active span,
#fp-nav ul li:hover a.active span {
height: 12px;
width: 12px;
margin: -6px 0 0 -6px;
border-radius: 100%;
}
#fp-nav ul li a span {
border-radius: 50%;
position: absolute;
z-index: 1;
height: 4px;
width: 4px;
border: 0;
background: #333;
left: 50%;
top: 50%;
margin: -2px 0 0 -2px;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
#fp-nav ul li:hover a span {
width: 10px;
height: 10px;
margin: -5px 0px 0px -5px;
}
#fp-nav ul li .fp-tooltip {
position: absolute;
top: -2px;
color: #fff;
font-size: 14px;
font-family: arial, helvetica, sans-serif;
white-space: nowrap;
max-width: 220px;
overflow: hidden;
display: block;
opacity: 0;
width: 0;
cursor: pointer;
}
.fp-auto-height.fp-section,
.fp-auto-height .fp-tableCell {
height: 100vh !important;
}
.fp-responsive .fp-auto-height-responsive.fp-section,
.fp-responsive .fp-auto-height-responsive .fp-tableCell {
height: 100vh !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://alvarotrigo.com/fullPage/jquery.fullPage.min.js"></script>
<div id="fullpage">
<div class="section " id="section1">
<h1>Section 1</h1>
</div>
<div class="section" id="section2">
<h1>Section 2</h1>
</div>
<div class="section" id="section3">
<h1>Section 3</h1>
</div>
</div>
您可以在$(window).resize(function () {})
中初始化插件方法doneResizing();
请注意,删除延迟意味着 fullpabe.js 将在调整大小时每秒进行数百次操作,因为调整大小事件会被触发数百次。
所以才存在延迟,才不会为了这么基础的东西疯狂的消耗机器资源。
您可以减少数量,但我不鼓励您完全删除它。
修改fullPage.js版本2.9.7 line 2150一改350为50,例如:
resizeId = setTimeout(function(){
reBuild(true);
}, 350);
改为:
resizeId = setTimeout(function(){
reBuild(true);
}, 50);
我不知道 jquery 或 javascript 我已经尽我所能修改了它,我想要完成的是当你在全屏模式下缩小或打开浏览器时缩小或变为全浏览器大小时,内容和高度会出现延迟 我想弄清楚如何消除该延迟
$(document).ready(function() {
$('#fullpage').fullpage({
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'],
navigation: true,
navigationPosition: 'right',
});
});
html {
text-rendering: optimizeLegibility;
height: 100%;
}
body {
height: 100%;
padding: 0px;
margin: 0px;
overflow: hidden;
background: #e6e6e6;
font-family: roboto, sans-serif;
font-weight: 400;
color: #777777;
line-height: 24px;
font-size: 16px;
}
html.fp-enabled,
.fp-enabled body {
margin: 0;
padding: 0;
overflow: hidden;
/*Avoid flicker on slides transitions for mobile phones #336 */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.fp-section {
position: relative;
-webkit-box-sizing: border-box;
/* Safari<=5 Android<=3 */
-moz-box-sizing: border-box;
/* <=28 */
box-sizing: border-box;
}
.fp-section.fp-table {
display: table;
table-layout: fixed;
width: 100%;
}
.fp-tableCell {
display: table-cell;
vertical-align: middle;
width: 100%;
height: 100vh;
}
.fp-scrollable {
overflow: hidden;
position: relative;
}
.fp-scroller {
overflow: hidden;
}
.iScrollIndicator {
border: 0 !important;
}
.fp-notransition {
-webkit-transition: none !important;
transition: none !important;
}
#fp-nav {
position: fixed;
z-index: 100;
margin-top: -32px;
top: 50%;
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
}
#fp-nav.right {
right: 17px;
}
#fp-nav ul {
margin: 0;
padding: 0;
}
#fp-nav ul li {
display: block;
width: 14px;
height: 13px;
margin: 7px;
position: relative;
}
#fp-nav ul li a {
display: block;
position: relative;
z-index: 1;
width: 100%;
height: 100%;
cursor: pointer;
text-decoration: none;
}
#fp-nav ul li a.active span,
#fp-nav ul li:hover a.active span {
height: 12px;
width: 12px;
margin: -6px 0 0 -6px;
border-radius: 100%;
}
#fp-nav ul li a span {
border-radius: 50%;
position: absolute;
z-index: 1;
height: 4px;
width: 4px;
border: 0;
background: #333;
left: 50%;
top: 50%;
margin: -2px 0 0 -2px;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
#fp-nav ul li:hover a span {
width: 10px;
height: 10px;
margin: -5px 0px 0px -5px;
}
#fp-nav ul li .fp-tooltip {
position: absolute;
top: -2px;
color: #fff;
font-size: 14px;
font-family: arial, helvetica, sans-serif;
white-space: nowrap;
max-width: 220px;
overflow: hidden;
display: block;
opacity: 0;
width: 0;
cursor: pointer;
}
.fp-auto-height.fp-section,
.fp-auto-height .fp-tableCell {
height: 100vh !important;
}
.fp-responsive .fp-auto-height-responsive.fp-section,
.fp-responsive .fp-auto-height-responsive .fp-tableCell {
height: 100vh !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://alvarotrigo.com/fullPage/jquery.fullPage.min.js"></script>
<div id="fullpage">
<div class="section " id="section1">
<h1>Section 1</h1>
</div>
<div class="section" id="section2">
<h1>Section 2</h1>
</div>
<div class="section" id="section3">
<h1>Section 3</h1>
</div>
</div>
您可以在$(window).resize(function () {})
doneResizing();
请注意,删除延迟意味着 fullpabe.js 将在调整大小时每秒进行数百次操作,因为调整大小事件会被触发数百次。 所以才存在延迟,才不会为了这么基础的东西疯狂的消耗机器资源。
您可以减少数量,但我不鼓励您完全删除它。
修改fullPage.js版本2.9.7 line 2150一改350为50,例如:
resizeId = setTimeout(function(){
reBuild(true);
}, 350);
改为:
resizeId = setTimeout(function(){
reBuild(true);
}, 50);