mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
final menu, final search
This commit is contained in:
parent
81adb766b5
commit
cee2868c24
@ -24,7 +24,6 @@
|
|||||||
<div class="search-area">
|
<div class="search-area">
|
||||||
<input type="search" class="input-search search-field" placeholder="Search everything">
|
<input type="search" class="input-search search-field" placeholder="Search everything">
|
||||||
<a class="search-close close" href="#">x</a>
|
<a class="search-close close" href="#">x</a>
|
||||||
<div class="search-results nav-popover"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="popover container hide">
|
||||||
|
<div class="row">
|
||||||
|
<div class="search-results"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
{% include footer.html %}
|
{% include footer.html %}
|
@ -17,10 +17,10 @@ var siteNavigation = {
|
|||||||
siteSearch: function() {
|
siteSearch: function() {
|
||||||
|
|
||||||
var $searchlink = $('.search-btn'),
|
var $searchlink = $('.search-btn'),
|
||||||
$searchpop = $('.search-area'),
|
$searcharea = $('.search-area'),
|
||||||
$searchfield = $('.search-field'),
|
$searchfield = $('.search-field'),
|
||||||
$searchresults = $('.search-results'),
|
$searchresults = $('.search-results'),
|
||||||
$navpop = $('.nav-main .nav-popover');
|
$searchpop = $('.popover');
|
||||||
|
|
||||||
// init jekyll search
|
// init jekyll search
|
||||||
$searchfield.simpleJekyllSearch({
|
$searchfield.simpleJekyllSearch({
|
||||||
@ -33,9 +33,11 @@ var siteNavigation = {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// show search
|
// show search
|
||||||
$searchpop.addClass('ready');
|
$searcharea.addClass('ready');
|
||||||
$searchfield.focus();
|
$searchfield.focus();
|
||||||
$searchresults.removeClass('hide');
|
if ( $searchfield.val().length ) {
|
||||||
|
$searchpop.removeClass('hide');
|
||||||
|
}
|
||||||
|
|
||||||
// hide menu too just in case
|
// hide menu too just in case
|
||||||
if ( $('body').hasClass('menu-open') ) {
|
if ( $('body').hasClass('menu-open') ) {
|
||||||
@ -44,8 +46,8 @@ var siteNavigation = {
|
|||||||
|
|
||||||
// bind the hide controls
|
// bind the hide controls
|
||||||
$(document).bind('click.hidethepop', function() {
|
$(document).bind('click.hidethepop', function() {
|
||||||
$searchpop.removeClass('ready');
|
$searcharea.removeClass('ready');
|
||||||
$searchresults.addClass('hide');
|
$searchpop.addClass('hide');
|
||||||
|
|
||||||
// unbind the hide controls
|
// unbind the hide controls
|
||||||
$(document).unbind('click.hidethepop');
|
$(document).unbind('click.hidethepop');
|
||||||
@ -60,12 +62,18 @@ var siteNavigation = {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// finally show popup upon first keypress
|
||||||
|
$searchfield.on('keyup', function() {
|
||||||
|
$searchpop.removeClass('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
// close button
|
||||||
$('.search-close').click(function(e){
|
$('.search-close').click(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// hide search area
|
// hide search area
|
||||||
$searchpop.removeClass('ready');
|
$searcharea.removeClass('ready');
|
||||||
$searchresults.addClass('hide');
|
$searchpop.addClass('hide');
|
||||||
|
|
||||||
// empty search field
|
// empty search field
|
||||||
$searchfield.val('').blur();
|
$searchfield.val('').blur();
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
li { display: inline-block; }
|
li { display: inline-block; }
|
||||||
|
|
||||||
.nav-popover {
|
.nav-popover {
|
||||||
background: @body-bg;
|
|
||||||
padding: @line-height-computed*1.5 0;
|
padding: @line-height-computed*1.5 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.clearfix;
|
.clearfix;
|
||||||
@ -53,14 +52,14 @@
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
|
|
||||||
// the icon
|
// the icons
|
||||||
&:before {
|
&:before {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
color: lighten(@text-color-dimmed, 10%);
|
color: lighten(@text-color-dimmed, 5%);
|
||||||
.transition;
|
.transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +136,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-results {
|
.search-results {
|
||||||
|
.clearfix;
|
||||||
|
|
||||||
|
.nav-link {
|
||||||
|
@media @breakpoint2 {
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popover {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 71px;
|
||||||
|
z-index: 6;
|
||||||
|
|
||||||
|
background: lighten(@page-bg, 3%);
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,.7);
|
||||||
|
box-shadow: 0 1px 4px fade(@brand-dark, 10%);
|
||||||
|
|
||||||
|
@media @breakpoint2 {
|
||||||
|
top: 0;
|
||||||
|
|
||||||
|
.row {
|
||||||
|
margin-top: @line-height-computed;
|
||||||
|
margin-bottom: @line-height-computed
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ body {
|
|||||||
background-color: @body-bg;
|
background-color: @body-bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.document { position: relative }
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Topbar
|
// Topbar
|
||||||
@ -187,33 +189,42 @@ a.close,
|
|||||||
// topbar and footer as fixed
|
// topbar and footer as fixed
|
||||||
// site background
|
// site background
|
||||||
//
|
//
|
||||||
|
.topbar {
|
||||||
|
height: 71px;
|
||||||
|
|
||||||
|
.menu-open & {
|
||||||
|
height: auto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.document {
|
||||||
|
background-color: @page-bg;
|
||||||
|
}
|
||||||
|
|
||||||
@media @breakpoint2 {
|
@media @breakpoint2 {
|
||||||
body {
|
body {
|
||||||
position: relative
|
position: relative
|
||||||
}
|
}
|
||||||
section[role=document] {
|
.document {
|
||||||
background-color: @page-bg;
|
z-index: 2;
|
||||||
margin-top: 71px;
|
margin-top: 71px;
|
||||||
.transition;
|
.transition;
|
||||||
|
|
||||||
.menu-open & {
|
.menu-open & {
|
||||||
margin-top: 300px;
|
margin-top: 300px;
|
||||||
}
|
}
|
||||||
margin-bottom: 380px;
|
margin-bottom: 380px;
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
border-top: 1px solid rgba(255,255,255,.7);
|
border-top: 1px solid rgba(255,255,255,.7);
|
||||||
border-bottom: 1px solid rgba(255,255,255,.7);
|
border-bottom: 1px solid rgba(255,255,255,.7);
|
||||||
box-shadow: 0 1px 4px fade(@brand-dark, 10%), 0 -1px 4px fade(@brand-dark, 10%);
|
box-shadow: 0 1px 4px fade(@brand-dark, 10%), 0 -1px 4px fade(@brand-dark, 10%);
|
||||||
}
|
}
|
||||||
.topbar,
|
.topbar,
|
||||||
.footer {
|
.footer {
|
||||||
position: fixed;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
position: fixed;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
.topbar {
|
.topbar {
|
||||||
min-height: 71px;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
box-shadow: inset 0 1px 4px fade(@brand-dark, 10%);
|
box-shadow: inset 0 1px 4px fade(@brand-dark, 10%);
|
||||||
border: none;
|
border: none;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user