Permalink
Browse files

Site: Rewrite popover and cleanups

  • Loading branch information...
1 parent b129e3b commit 6762ec68730921d5fe4ca524d74310406600fe44 @sindresorhus sindresorhus committed Jul 19, 2012
Showing with 138 additions and 136 deletions.
  1. +72 −93 index.html
  2. +33 −24 site/css/main.css
  3. +33 −19 site/js/main.js
View
Oops, something went wrong.
View
@@ -43,11 +43,6 @@ a:hover {
color: #787e7e;
}
-.nav-tabs > li > a,
-.nav-pills > li > a {
- line-height: 20px;
-}
-
p {
font-size: 15px;
line-height: 1.5;
@@ -110,8 +105,11 @@ header nav a:first-child {
margin-bottom: 20px;
}
-.applist a {
+.applist .row > div {
white-space: nowrap;
+}
+
+.applist a {
position: relative; /* popover */
}
@@ -123,24 +121,9 @@ header nav a:first-child {
background-color: rgba(0, 0, 0, .2);
}
-.applist .popover {
- margin: 0;
- cursor: default;
- color: #333;
- white-space: normal;
- z-index: 999;
-}
-
-.applist .popover-title {
- padding: 9px 70px 9px 15px;
-}
-
-.applist .popover-title a {
- font-size: 13px;
- line-height: 18px;
- position: absolute;
- top: 16px;
- right: 20px;
+.applist a:hover .label {
+ text-decoration: none !important;
+ color: red;
}
.applist.labs {
@@ -151,7 +134,13 @@ header nav a:first-child {
columns: 3;
}
+.applist.labs {
+ list-style: none;
+ margin: 0;
+}
+
.applist.labs li {
+ margin-bottom: 20px;
-webkit-column-break-inside: avoid;
-moz-column-break-inside: avoid;
-ms-column-break-inside: avoid;
@@ -169,6 +158,26 @@ header nav a:first-child {
margin-right: 5px;
}
+.popover {
+ margin: 0;
+ cursor: default;
+ color: #333;
+ white-space: normal;
+ z-index: 999;
+}
+
+.popover-title {
+ padding: 9px 70px 9px 15px;
+}
+
+.popover-title a {
+ font-size: 13px;
+ line-height: 18px;
+ position: absolute;
+ top: 16px;
+ right: 20px;
+}
+
.zocial.red {
background-color: #a82400;
}
View
@@ -2,26 +2,40 @@
(function() {
'use strict';
- // Apps popover
- function hover() {
- $( this ).popover('toggle');
- }
+ $.fn.persistantPopover = function() {
+ var popoverTimeout;
- $('.applist a').each(function() {
- var $this = $( this );
- $this.popover({
- placement: 'in right',
- animation: false,
- title: $this[0].firstChild.textContent + '<a href="' + $this.data('source') + '">Go to site</a>'
- });
- })
- .off()
- .hoverIntent( hover, hover )
- .on('click', '.popover', function( e ) {
- // Prevent click on the popover, but allow links inside
- if ( e.target.nodeName.toLowerCase() !== 'a' ) {
- e.preventDefault();
+ function delay() {
+ popoverTimeout = setTimeout(function() {
+ $('.popover').hide();
+ }, 100);
}
- });
+
+ this.each(function() {
+ var $this = $( this );
+ $this.popover({
+ trigger: 'manual',
+ placement: 'right',
+ animation: false,
+ title: this.firstChild.textContent + '<a href="' + $this.data('source') + '">Website</a>'
+ });
+ })
+ .mouseenter(function() {
+ clearTimeout( popoverTimeout );
+ $('.popover').remove();
+ $( this ).popover('show');
+ })
+ .mouseleave(function() {
+ delay();
+ $('.popover').mouseenter(function() {
+ clearTimeout( popoverTimeout ) ;
+ }).mouseleave(function() {
+ delay();
+ });
+ });
+ };
+
+ // Apps popover
+ $('.applist a').persistantPopover();
}());

0 comments on commit 6762ec6

Please sign in to comment.