Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 04645f273fcfff803a14f68cadb0202891868e52 1 parent 959abbd
@jarmo authored
Showing with 23 additions and 0 deletions.
  1. +19 −0 public/hackersays.js
  2. +4 −0 public/themes/base.scss
View
19 public/hackersays.js
@@ -11,6 +11,25 @@ $(function() {
}
if ($.cookie("theme")) showTheme($.cookie("theme"));
+
+ var opacityResetTimer, mouseMoveTimer, lastPageX, lastPageY,
+ opacityElsSelector = "#share a, #toolbar a",
+ originalControlsOpacity = $(opacityElsSelector).css("opacity");
+
+ $(document).mousemove(function(ev) {
+ clearTimeout(mouseMoveTimer);
+ mouseMoveTimer = setTimeout(function() {
+ if (ev.pageX == lastPageX && ev.pageY == lastPageY)
+ return;
+
+ lastPageX = ev.pageX; lastPageY = ev.pageY;
+ $(opacityElsSelector).stop(true).animate({opacity: 1}, 400);
+ clearTimeout(opacityResetTimer);
+ opacityResetTimer = setTimeout(function() {
+ $(opacityElsSelector).stop(true).animate({opacity: originalControlsOpacity}, 800);
+ }, 2000)
+ }, 100);
+ });
});
$(function() {
View
4 public/themes/base.scss
@@ -47,6 +47,8 @@ strong { font-weight: bolder; }
#template { display: none; }
+$defaultOpacity: 0.4;
+
#toolbar {
$w: 180px;
overflow: hidden;
@@ -64,6 +66,7 @@ strong { font-weight: bolder; }
background-color: rgba(black, .1);
background-position: center;
background-repeat: no-repeat;
+ opacity: $defaultOpacity;
}
a.play {
width: 60px; height: 60px;
@@ -89,4 +92,5 @@ strong { font-weight: bolder; }
position: absolute; bottom: 35px; right: 30px;
text-align: right;
min-width: 150px;
+ a { opacity: $defaultOpacity; }
}
Please sign in to comment.
Something went wrong with that request. Please try again.