2015-09-08 38 views
0

我使用的代碼如何在標籤deep_link zurb基礎中添加偏移量?

凸片
<div class="row tabs-home" > 
<dl class="tabs text-center " data-tab data-options="deep_linking:true"> 
    <dd><a href="#panel0">CRS</a></dd> 
    ... 
    <dd><a href="#panel5">Soluções Marketing</a></dd> 
</dl> 

具有「位置是:固定」的報頭,並點擊選項卡渦旋發生[IMAGE 2],但是標題的下方。 有必要點擊標籤有一個偏移頭[IMAGE 3] [enter image description here] 1

我試圖改變foundation.tab.js。 並增加從foundation.tab.js

if (settings.deep_linking) { 

      if (settings.scroll_to_content) { 

       // retain current hash to scroll to content 
       go_to_hash(location_hash || target_hash); 

       if (location_hash == undefined || location_hash == target_hash) { 
        tab.parent()[0].scrollIntoView(); 
        tab.parent()[0].animate({ scrollTop: $('#tab-fixed').offset().top + 200 }); 
       } else { 
        S(target_hash)[0].scrollIntoView(); 
       } 
      } else { 
       // prefix the hashes so that the browser doesn't scroll down 
       if (location_hash != undefined) { 
        go_to_hash('fndtn-' + location_hash.replace('#', '')); 
       } else { 
        go_to_hash('fndtn-' + target_hash.replace('#', '')); 
       } 
      } 
     } 

tab.parent()[0].animate({ scrollTop: $('#tab-fixed').offset().top + 200 }); 

行207我如何當點擊,滾動有一個頭的偏移?

回答

0

好吧,我解決這個問題與UM scrollTop的在jQuery和刪除thhis deep_link

 //SCROLL TAB 
     $(document).ready(function(){ 
      $('#tab-fixed').on('click', function(){ 
       $('html,body').animate({scrollTop: $(this).offset().top - 190}, 500); 
      }); 
     }); 

HTML

<section id="tab-fixed" class="clearfix"> 
<div id="line-tabs" class="clearfix"> 
    <div class="row tabs-home" > 
     <dl class="tabs text-center " data-tab> 
      <dd><a href="#crs-panel1">CRS</a></dd> 
      ... 
      <dd><a href="#crs-panel3">Soluções Marketing</a></dd> 
     </dl> 
    </div> 
</div>