Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add opacity to share and toolbar links removed by mouse move events.

  • Loading branch information...
commit 04645f273fcfff803a14f68cadb0202891868e52 1 parent 959abbd
Jarmo Pertman authored

Showing 2 changed files with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. +19 0 public/hackersays.js
  2. +4 0 public/themes/base.scss
19 public/hackersays.js
@@ -11,6 +11,25 @@ $(function() {
11 11 }
12 12
13 13 if ($.cookie("theme")) showTheme($.cookie("theme"));
  14 +
  15 + var opacityResetTimer, mouseMoveTimer, lastPageX, lastPageY,
  16 + opacityElsSelector = "#share a, #toolbar a",
  17 + originalControlsOpacity = $(opacityElsSelector).css("opacity");
  18 +
  19 + $(document).mousemove(function(ev) {
  20 + clearTimeout(mouseMoveTimer);
  21 + mouseMoveTimer = setTimeout(function() {
  22 + if (ev.pageX == lastPageX && ev.pageY == lastPageY)
  23 + return;
  24 +
  25 + lastPageX = ev.pageX; lastPageY = ev.pageY;
  26 + $(opacityElsSelector).stop(true).animate({opacity: 1}, 400);
  27 + clearTimeout(opacityResetTimer);
  28 + opacityResetTimer = setTimeout(function() {
  29 + $(opacityElsSelector).stop(true).animate({opacity: originalControlsOpacity}, 800);
  30 + }, 2000)
  31 + }, 100);
  32 + });
14 33 });
15 34
16 35 $(function() {
4 public/themes/base.scss
@@ -47,6 +47,8 @@ strong { font-weight: bolder; }
47 47
48 48 #template { display: none; }
49 49
  50 +$defaultOpacity: 0.4;
  51 +
50 52 #toolbar {
51 53 $w: 180px;
52 54 overflow: hidden;
@@ -64,6 +66,7 @@ strong { font-weight: bolder; }
64 66 background-color: rgba(black, .1);
65 67 background-position: center;
66 68 background-repeat: no-repeat;
  69 + opacity: $defaultOpacity;
67 70 }
68 71 a.play {
69 72 width: 60px; height: 60px;
@@ -89,4 +92,5 @@ strong { font-weight: bolder; }
89 92 position: absolute; bottom: 35px; right: 30px;
90 93 text-align: right;
91 94 min-width: 150px;
  95 + a { opacity: $defaultOpacity; }
92 96 }

0 comments on commit 04645f2

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