2017-03-02 12 views
1

私のウェブサイトにhttps://projects.lukehaas.me/scrollify/を使用しています。モーダルを開いた後にスクロール機能を無効にする際に問題があります。私はモーダルを開くために標準のonclickアクションを使用しているので、そこに何かを注入することができますが、私は何がわかりません。スクロール - モーダルが開いているときにセクションのスクロールを無効にする

これは私の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

あなたが追加してもいいかもしれません: 'else($( 'yourModalID').css( 'display')!= 'none'){スクロールしない}'回答が編集されました –

+0

おそらくうまくいきません。 –

関連する問題