当window.width>有人知道是否可以启用fullpage()。 700 下, 当window.width少于700时,将其关闭。
我需要在平板电脑和手机上关闭它。
我的错误解决方案
`https://codepen.io/liashok/pen/ERXozv?editors=1111`
和错误
“fullPage:Fullpage.js只能初始化一次而且你多次这样做!”
答案 0 :(得分:0)
您需要跟踪变量中的状态(无论是否已附加),如果您越过边界从&gt; 700到<= 700,则会破坏整页效果。试试这个。
$(function(){
var attached = false;//track it's current state
manageFullPage();
$(window).resize( function() {
manageFullPage();
} )
function manageFullPage(){
if( $(this).width() > 700 ) {
if(! attached){
$('#fullpage').fullpage();
attached = true;//note it's been attached
}
}else{//we don't want fullpage. destroy it if it's attached
if(attached){
attached = false;//mark destroyed
$.fn.fullpage.destroy('all');
}
}
}
});
&#13;
* {
margin: 0;
}
.section {
border: 1px solid red;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.8/jquery.fullPage.js"></script>
<div id="fullpage">
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
</div>
&#13;
答案 1 :(得分:0)
非常简单,只需输入:
$('#fullPage').fullpage({
responsive: 700 // here is solution
})
= d