2016-10-26 38 views
0

欣賞如果你能幫助我。我有幾個引導行,其中一個包含2列 - 留給可滾動文本,正確的描述由詞綴固定。當我向下滾動到左列的頂部時隱藏右列,並在左列結束時隱藏。我試圖讓它以這種方式工作,但沒有成功。現在固定在身體上(而不是像我想要的那樣粘貼到父塊的頂部和底部邊框)。我究竟做錯了什麼? (除了我說英語:))將固定引導詞綴固定到近立柱

的index.html:

... 
<body data-spy="scroll"> 
... 
    <div class="chapter"> 
     <div class="row" data-target="#myScrollSpy"> 
      <div class="col-md-5" > 
       my precious scrollable text 
      </div> 
      <div class="col-md-6" id="myScrollSpy"> 
       <div id="myAffix"> 
        my not so good working affix 
       </div> 
      </div> 
     </div> 
    </div> 
... 
    <script> 
    $('#myAffix').affix({ 
       offset: { 
       top: 100, 
       bottom: 100 
       } 
      }); 
    </script> 
... 
</body> 

的style.css:

body { 
    position: relative; 
} 

.affix { 
    top: 150px; 
    width: 80%; 
} 

@media (min-width: 1200px) { 
    .affix { 
    }   
} 

.affix-bottom { 
    position: absolute; 
} 

@media (min-width: 1200px) { 
    .affix-bottom { 
    } 
} 

回答