Skip to content
Browse files

hash wonk

  • Loading branch information...
1 parent e61dd26 commit 275b5dcf03dd8d29102ec7ceacd1c92006be1d4b @defunkt defunkt committed
Showing with 15 additions and 6 deletions.
  1. +7 −3 tom.coffee
  2. +8 −3 tom.js
View
10 tom.coffee
@@ -16,9 +16,13 @@ $.fn.scrollTo: (speed) ->
$ ->
$('#demo').click ->
- $('#demo-box').show()
- $('#demo').scrollTo(1)
- true
+ $('#demo-box').toggle()
+ if $('#demo-box:visible').length > 0
+ $('#demo').scrollTo(1)
+ window.location.hash: '#demo'
+ else
+ window.location.hash: ''
+ false
$('#demo').click() if window.location.hash is "#demo"
View
11 tom.js
@@ -18,9 +18,14 @@ $.fn.scrollTo = function scrollTo(speed) {
};
$(function() {
$('#demo').click(function() {
- $('#demo-box').show();
- $('#demo').scrollTo(1);
- return true;
+ $('#demo-box').toggle();
+ if ($('#demo-box:visible').length > 0) {
+ $('#demo').scrollTo(1);
+ window.location.hash = '#demo';
+ } else {
+ window.location.hash = '';
+ }
+ return false;
});
if (window.location.hash === "#demo") {
$('#demo').click();

0 comments on commit 275b5dc

Please sign in to comment.
Something went wrong with that request. Please try again.