2014-05-25 36 views
0

我試圖從Bootstrap庫實現scrollspy。目前我手動激活的選項卡保持激活狀態,如果我滾動或點擊,nav上的任何內容都不會改變。我有以下幾點。有任何想法嗎?bootstrap scrollspy不能與HAML配合使用

.row 
    %ul{ :id => "navthingy", :class => "nav nav-tabs nav-stacked fixed span3" } 
    %li.active 
     %a.icon-user{ :href => '#profile'} 
     Profile 
    %li 
     %a.icon-lightbulb{ :href => '#ideas'} 
     Ideas 
    %li 
     %a.icon-arrow-right{ :href => '#followings'} 
     Followings 
    %li 
     %a.icon-group{ :href => '#teams'} 
     Teams 
    .span3 
    .span9{ :data => { :spy => "scroll", :target => "#navthingy" } } 
    .header-banner 
     %a.anchor{ :id => 'profile'} 
     %h2 
     = @user.name 
     %small 
      = pluralize(@user.ideas.count, "Idea") 
      = pluralize(@user.followings.count, "Following") 
      = @user.created_at.strftime("Joined %B %Y") 
    .user-info 
     %p 
     %strong= @user.occupation 
     %p= @user.info 

    .header-banner.spaced 
     %a.anchor{ :id => 'ideas'} 
     %h2 
     Ideas 
     %small 
      = "Suggested #{pluralize(@user.ideas.count, 'idea')}"  
    = render partial: 'ideas/ideas', locals: { ideas: @user.ideas } 

    .header-banner.spaced 
     %a.anchor{ :id => 'followings'} 
     %h2 
     Following 
     %small 
      = "Following #{pluralize(@user.following_ideas.count, 'idea')}" 
    = render partial: 'ideas/ideas', locals: { ideas: @user.following_ideas } 

    .header-banner.spaced 
     %a.anchor{ :id => 'teams'} 
     %h2 
     Teams 
     %small 
      = "Member on #{pluralize(@user.accepted_teams.count, 'team')}" 
    = render partial: 'ideas/ideas', locals: { ideas: @user.accepted_teams.map { |x| x.idea } } 

:javascript 
    $(document).ready(function() { 
     equalHeight($(".thumbnail-top")); 
    }); 

回答

0

如果你想達到的東西like here。你可以使用Appizy。只需將您的內容放入電子表格中,然後該軟件就會創建一個帶有滾動條的完美單頁網頁。

有一個教程video here as well

希望能幫到你! Nicolas

相關問題