2017-08-09 28 views
0

jQuery插件我與完整的文檔使用:
https://github.com/alvarotrigo/fullPage.jsfullpage.js,具有較大的部分,並禁用某些部分滾動

我想要什麼:我想有完整的禁用我的第二部分頁面捕捉效果,並使其具有比常規部分(150vh等)更大的高度。

問題:我已經把它加一個新的高度,以第2

.ok{ 
    width:100%; 
    height:2000px; 
    border:1px solid black; 
} 

嘗試它,也發現了文件,以取消部分在一些方法捕捉: $.fn.fullpage.setAutoScrolling(false);
但是當我滾動上下,一些部分快速回彈,而且不再流暢。
(例如,向下滾動到第2,然後嘗試滾動到第1節,其卡太快)

我的小提琴:https://jsfiddle.net/jzhang172/kemtmm9a/30/

$('#fullpage').fullpage({ 
 
    sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'], 
 
    
 
    \t afterLoad: function(anchorLink, index){ 
 
\t \t var loadedSection = $(this); 
 
\t \t if(index == 1){ 
 

 
$.fn.fullpage.setAutoScrolling(true); 
 
\t \t } 
 
\t \t //using index 
 
\t \t if(index == 2){ 
 

 
$.fn.fullpage.setAutoScrolling(false); 
 
\t \t } 
 
\t \t if(index == 3){ 
 

 
$.fn.fullpage.setAutoScrolling(true); 
 
\t \t } 
 
\t \t //using anchorLink 
 
\t \t if(anchorLink == 'secondSlide'){ 
 
\t \t \t alert("Section 2 ended loading"); 
 
\t \t } 
 
\t } 
 

 
});
.section { 
 
    text-align:center; 
 
} 
 
.ok{ 
 
    width:100%; 
 
    height:2000px; 
 
    border:1px solid black; 
 
} 
 
.la{ 
 
    height:200%; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://rawgit.com/alvarotrigo/fullPage.js/master/jquery.fullPage.js"></script> 
 
<div id="fullpage"> 
 
    <div class="section">One</div> 
 
    <div class="section la"> 
 
     <div class="slide">Two 1</div> 
 
     <div class="slide">Two 2</div> 
 
    </div> 
 
    <div class="section fp-auto-height"><div class="ok"></div>Three</div> 
 
    <div class="section">Four</div> 
 
</div>

回答

0

我認爲問題與你的js代碼,檢查下面摘錄

$('#fullpage').fullpage({ 
 
    sectionsColor: ['yellow', 'orange', '#C0C0C0', '#ADD8E6'], 
 
    anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage'], 
 
    menu: '#menu', 
 
    scrollingSpeed: 1000, 
 
afterLoad: function(anchorLink, index){ 
 
\t var loadedSection = $(this); 
 

 
\t //using index 
 
\t if(index == 2){ 
 
\t \t $.fn.fullpage.setAllowScrolling(false); 
 
\t } 
 

 
\t //using anchorLink 
 
\t if(anchorLink == 'secondSlide'){ 
 
\t \t alert("Section 2 ended loading"); 
 
\t } 
 
} 
 
});
.section { 
 
    text-align:center; 
 
} 
 
.ok{ 
 
    width:100%; 
 
    height:2000px; 
 
    border:1px solid black; 
 
} 
 
.la{ 
 
    height:200%; 
 
}
<div id="fullpage"> 
 
    <div class="section">One</div> 
 
    <div class="section"> 
 
     <div class="slide">Two 1</div> 
 
     <div class="slide la">Two 2</div> 
 
    </div> 
 
    <div class="section fp-auto-height"><div class="ok"></div>Three</div> 
 
    <div class="section">Four</div> 
 
</div> 
 

 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://rawgit.com/alvarotrigo/fullPage.js/master/jquery.fullPage.js"></script>

+0

謝謝,但那不是我要找的。我想在第二部分中完全停用滾動效果。它看起來像你的,一切都是流暢的。 – Snorlax

+0

@Snorlax嗨,我已禁用滾動部分2'two1',這是你需要什麼? –

+0

不,我想'節la'滾動jquery捕捉效果被禁用,沒有禁用滾動。例如,當你在'la'節中時,我將在那裏有150vh的內容,當在該150vh部分中滾動時,我希望滾動表現爲正常,然後在滾動到第三部分時返回到對齊。 – Snorlax