Commit 6762ec68 authored by Sindre Sorhus's avatar Sindre Sorhus

Site: Rewrite popover and cleanups

parent b129e3b7
This diff is collapsed.
......@@ -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;
}
......
......@@ -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();
}());
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment