Commit c5f155638099585a43e641654a1ed8b3431e44d7

Authored by Georg Hopp
1 parent 131f9392

Menu now responds on page scrolling.

@@ -46,13 +46,23 @@ App.scroll = -> @@ -46,13 +46,23 @@ App.scroll = ->
46 "center " + bg_pos + "px") 46 "center " + bg_pos + "px")
47 content.css("display", "block") 47 content.css("display", "block")
48 48
  49 +App.scroll2 = ->
  50 + v_scroll = $(document).scrollTop()
  51 + section = 0
  52 + for value, index in $(".section")
  53 + if v_scroll >= $(value).offset().top
  54 + section = index
  55 + if not $($("#nav a")[section]).hasClass('active')
  56 + $("#nav a").removeClass("active")
  57 + $($("#nav a")[section]).addClass('active')
  58 +
49 $(document).on "page:change", -> 59 $(document).on "page:change", ->
50 App.init() 60 App.init()
51 61
  62 +$(window).on "scroll", ->
  63 + App.scroll2()
  64 +
52 $(document).ready -> 65 $(document).ready ->
53 App.init() 66 App.init()
54 67
55 -#$(window).on "scroll", ->  
56 -# App.scroll()  
57 -  
58 # vim: set ts=2 sw=2: 68 # vim: set ts=2 sw=2:
@@ -109,7 +109,7 @@ p { @@ -109,7 +109,7 @@ p {
109 font-weight: bold; 109 font-weight: bold;
110 } 110 }
111 #nav li a:hover { 111 #nav li a:hover {
112 - color: rgba(255,255,255,1); 112 + color: rgba(255,255,255,0.7);
113 } 113 }
114 #nav li a.active { 114 #nav li a.active {
115 color: rgba(255,255,255,1); 115 color: rgba(255,255,255,1);
Please register or login to post a comment