Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More work on web site

  • Loading branch information...
commit 8c526f42321d741cf8cd004e06538968a59192dc 1 parent 9e7c985
@winton authored
View
BIN  site/github.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
10 site/stasis.css.scss
@@ -38,18 +38,28 @@ ul {
display: inline;
line-height: 25px;
padding: 0 9px;
+
+ a.selected {
+ color: #06599E;
+ font-weight: 700;
+ }
}
}
#github {
position: fixed;
height: 141px;
+ opacity: 0.5;
right: 0;
top: 25px;
width: 141px;
z-index: 10000;
}
+#github:hover {
+ opacity: 1;
+}
+
#title {
color: #3393E4;
font-family: 'Amaranth', sans-serif;
View
52 site/stasis.js.coffee
@@ -1,11 +1,41 @@
-$('a[href*=#]').click ->
- anchor = $(this).attr('href').match(/#(.*)/)[1]
- target = $('a[name=' + anchor + ']')
- ran = false
- $('html, body').animate { scrollTop: target.offset().top - 60 }, 400, ->
- unless ran
- offset = this.scrollTop
- location.hash = anchor
- this.scrollTop = offset
- ran = true
- false
+smoothScroll = ->
+ $('a[href*=#]').click ->
+ anchor = $(this).attr('href').match(/#(.*)/)[1]
+ target = $('a[name=' + anchor + ']')
+ ran = false
+ $('html, body').animate { scrollTop: target.offset().top - 60 }, 400, ->
+ unless ran
+ offset = this.scrollTop
+ this.scrollTop = offset
+ ran = true
+ false
+
+highlightNav = ->
+ anchors = $('h2 a[name]')
+ anchor_links = $('ul a')
+ positions = anchors.map (i, item) ->
+ $(item).offset().top
+
+ anchors = $.makeArray(anchors).reverse()
+ anchor_links = $.makeArray(anchor_links).reverse()
+ positions = $.makeArray(positions).reverse()
+
+ scrollHappened = ->
+ anchor_index = null
+ scroll_y = this.scrollY
+ $.each positions, (i, item) ->
+ if scroll_y >= item - 70
+ anchor_index = i
+ return false
+ if anchor_index?
+ $(anchor_links).removeClass 'selected'
+ $(anchor_links[anchor_index]).addClass 'selected'
+ if scroll_y < positions[positions.length - 1] - 70
+ $(anchor_links).removeClass 'selected'
+
+ $(window).scroll scrollHappened
+ scrollHappened()
+
+$ ->
+ smoothScroll()
+ highlightNav()
Please sign in to comment.
Something went wrong with that request. Please try again.