Commit c5f155638099585a43e641654a1ed8b3431e44d7
1 parent
131f9392
Menu now responds on page scrolling.
Showing
2 changed files
with
14 additions
and
4 deletions
... | ... | @@ -46,13 +46,23 @@ App.scroll = -> |
46 | 46 | "center " + bg_pos + "px") |
47 | 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 | 59 | $(document).on "page:change", -> |
50 | 60 | App.init() |
51 | 61 | |
62 | +$(window).on "scroll", -> | |
63 | + App.scroll2() | |
64 | + | |
52 | 65 | $(document).ready -> |
53 | 66 | App.init() |
54 | 67 | |
55 | -#$(window).on "scroll", -> | |
56 | -# App.scroll() | |
57 | - | |
58 | 68 | # vim: set ts=2 sw=2: | ... | ... |
Please
register
or
login
to post a comment