Skip to content

Instantly share code, notes, and snippets.

@tkh44
Created February 16, 2012 22:09
Show Gist options
  • Save tkh44/1848231 to your computer and use it in GitHub Desktop.
Save tkh44/1848231 to your computer and use it in GitHub Desktop.
resize function
library = function() {
var elements = {};
var values = {
searchHeight: null,
logoHeight: null,
selected: 'selected',
category: 'category',
open: 'open',
catSelected: 'cat-selected',
sub: 'sub',
hasFocus: true,
loader: '<div id="loader"></div>',
title: 'Homeland HealthCare Library'
};
var keys = {
enter: 13,
escape: 27,
up: 38,
down: 40,
array: [13, 27, 38, 40]
};
function initialize() {
elements = {
search: $('#search-field'),
searchWrapper: $('#search'),
logo: $('#logo'),
content: $('#content'),
list: $('#static-list'),
window: $(window),
results: null,
category: null
};
elements.results = jQuery('<ul>', { id: 'results' }).insertBefore(elements.list);
elements.category = $('.category', elements.list);
values.searchHeight = elements.searchWrapper.innerHeight();
values.logoHeight = elements.logo.innerHeight();
elements.window.resize(function() {
var winH = elements.window.height();
var listH = winH - (values.searchHeight + values.logoHeight);
//console.log('window height: ' + winH);
//console.log('list height: ' + listH);
//console.log('list height + search height: ' + (listH + values.searchHeight));
elements.list.height(listH);
elements.results.height(listH);
elements.content.height(winH-1);
//console.log('content height: ' + elements.content.height());
elements.search.width(elements.searchWrapper.width() - 8);
elements.logo.width(elements.searchWrapper.width() - 7);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment