2016-04-11 7 views
0

私すべては私のメニューとアンカーポイントでうまく働くが、リンクは動作を停止し、次のコードを追加した後、持っていた:アンカーポイント

$('#fullpage').fullpage({ 
    onLeave: function(index, nextIndex, direction){ 
     var leavingSection = $(this); 

     //after leaving section 2 
     if(index == 1 && direction =='down'){ 
      $('header').addClass('active'); 
     } 

     else if(index == 2 && direction == 'up'){ 
      $('header').removeClass('active'); 

     } 
    } 
}); 

私の意図は、私のヘッダーを非表示にすることであり、唯一の2番目のセクションの後に表示されますが、アンカーポイントはもう動作しません。

私のヘッダーHTML

<header> 
    <ul id="myMenu"> 
     <li data-menuanchor="topo" class="active"><a href="#topo"><img src="img/dcb-white.svg"></a></li> 
     <li data-menuanchor="contato"><a href="#contato">Contato</a></li> 
     <li data-menuanchor="sobre"><a href="#sobre">Sobre Mim</a></li> 
     <li data-menuanchor="historico"><a href="#historico">Histórico</a></li> 
     <li data-menuanchor="portfolio"><a href="#portfolio">Portfolio</a></li> 
     <li data-menuanchor="topo" class="active"><a href="#topo">Topo</a></li> 
    </ul> 
</header> 

ヘッダーCSS

header{ 
    position:fixed; 
    height: auto; 
    display:block; 
    width: 100%; 
    background: #000; 
    z-index:9; 
    text-align:center; 
    color: #fff; 
    top:0px; 
    visibility: hidden; 
    opacity: 0; 
    -webkit-transition: all 0.8s; 
    -moz-transition: all 0.8s; 
    transition: all 0.8s; 
} 

header.active { 
    visibility: visible; 
    opacity: 1; 
    -webkit-transition: all 0.8s; 
    -moz-transition: all 0.8s; 
    transition: all 0.8s; 
} 

答えて

0

まあ、基本的にはフルページを言っていません。あなたはアンカーを使いたいと思っています。

初期化(使用していない)にはanchorsオプションを使用するか、それぞれのセクションでdata-anchor属性を使用する必要があります。 (どちらかを使用していないようです)

in the documentationについてもっと読む。

アンカー:(デフォルト[])は、各セクションのURLに表示されるためにアンカーリンク(#example)を定義します。アンカー値は一意でなければなりません。配列内のアンカーの位置は、アンカーが適用されるセクションを定義します。 (2番目のセクションの2番目の位置など)。アンカーを使用すると、ブラウザーを使用して前方ナビゲーションと後方ナビゲーションも可能になります。このオプションを使用すると、ユーザーは特定のセクションまたはスライドをブックマークすることもできます。注意してください!アンカーは、サイトの任意のID要素(IEのNAME要素)と同じ値を持つことはできません。アンカーは、ここで説明するように、属性data-anchorを使用してHTML構造体に直接定義できます。

関連する問題