mirror of
https://github.com/danbulant/api_docs
synced 2026-05-19 04:08:40 +00:00
Adds js handler for setting search info box width equal to content width
Signed-off-by: Christopher Rogers <chrissrogers@gmail.com>
This commit is contained in:
parent
0ebbae94fe
commit
a4e1fb3c24
1 changed files with 10 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
(function (global) {
|
||||
|
||||
var $global = $(global);
|
||||
var content, searchInfo;
|
||||
var content, darkBox, searchInfo;
|
||||
var highlightOpts = { element: 'span', className: 'search-highlight' };
|
||||
|
||||
var index = new lunr.Index;
|
||||
|
|
@ -33,11 +33,16 @@
|
|||
|
||||
function bind () {
|
||||
content = $('.content');
|
||||
darkBox = $('.dark-box');
|
||||
searchInfo = $('.search-info');
|
||||
|
||||
$('#input-search')
|
||||
.on('keyup', search)
|
||||
.on('focus', active)
|
||||
.on('blur', inactive);
|
||||
|
||||
$global.on('resize', resize);
|
||||
resize();
|
||||
}
|
||||
|
||||
function search (event) {
|
||||
|
|
@ -88,4 +93,8 @@
|
|||
content.unhighlight(highlightOpts);
|
||||
}
|
||||
|
||||
function resize () {
|
||||
searchInfo.innerWidth(content.innerWidth() - darkBox.innerWidth());
|
||||
}
|
||||
|
||||
})(window);
|
||||
|
|
|
|||
Loading…
Reference in a new issue