2017-03-02 26 views
1

我使用我的網站上https://projects.lukehaas.me/scrollify/和我有麻煩禁用它的滾動功能後,我打開一個模式禁用部分滾動。我正在使用標準的onclick動作來打開模式,所以我可以在其中注入某些東西,但我不確定是什麼。Scrollify - 時態是開放

這是我Scrollify初始化:

jQuery.scrollify({ 
section : ".vc_section", 
sectionName : "section-name", 
interstitialSection : "", 
easing: "easeOutExpo", 
scrollSpeed: 2000, 
offset : 0, 
scrollbars: true, 
standardScrollElements: "footer", 
setHeights: true, 
overflowScroll: true, 
updateHash: false, 
touchScroll: true, 
before:function(i,panels) { 
var ref = panels[i].attr("data-section-name"); 
if(ref === "first") { 
    jQuery("#hero-container").removeClass("hidden"); 
} 

if(ref === "second") { 
jQuery("#hero-container").addClass("hidden"); 
} 
}, 
after:function() {}, 
afterResize:function() {}, 
afterRender:function() {} 
}); 

然後,我通過一個簡單的onclick函數中調用一個模式:

jQuery('.schedule-visit-toggle, .schedule-visit-toggle a').on('click touchstart', function(evt) { 
    evt.stopPropagation(); 
    evt.preventDefault(); 

    jQuery('#schedule-visit-modal').foundation('open'); 
}); 
+0

如果您在已經嘗試或已經擁有的內容上發佈了一些示例代碼,將會更容易 –

+0

已更新我的問題 –

回答

1

呼叫$.scrollify.disable()的模式打開時禁用Scrollify。

+0

這麼簡單,我跳過它,謝謝! –

0

我會盡量給它一個鏡頭反正..

我想當模態沒有顯示時,它的css中有display: none;

所以你可以做的是:

if ($('#yourModalID').css('display') === 'none') { 
    scrollify 
} else { 
    do not scrollify 
}); 

可能是它不工作,但值得一試..

+0

我可以嘗試但不需要基本上重新初始化它,作爲條件語句,當模態被切換? –

+0

可能是你可以添加:(!$( '#yourModalID')的CSS( '顯示')= '無')'否則{不scrollify}' - >答案編輯 –

+0

,可能不工作,對不起:■ –