Skip to content

Instantly share code, notes, and snippets.

@danbruegge
Last active March 18, 2017 16:29
Show Gist options
  • Save danbruegge/8aaf3df26f513111864f624e3d68255a to your computer and use it in GitHub Desktop.
Save danbruegge/8aaf3df26f513111864f624e3d68255a to your computer and use it in GitHub Desktop.
Before and after clean up
import jQuery from 'jquery';
let tempHeight = '';
export default function footerInit () {
jQuery('#FooterSwitch').on('click', toogle);
}
function toogle () {
const $footer = jQuery('#Footer');
const footerPosition = parseInt($footer.css('bottom'), 10);
const isHidden = footerPosition < 0;
if (isHidden) {
show($footer);
} else {
hide($footer);
}
}
function show ($element) {
tempHeight = $element.css('bottom');
$element.css('bottom', 0);
}
function hide ($element) {
$element.css('bottom', tempHeight);
}
import jQuery from 'jquery';
let tempHeight = '';
export default function FooterInit () {
jQuery('#FooterSwitch').on('click', toogle);
}
function toogle (event) {
const $footer = jQuery('#Footer');
if (parseInt($footer.css('bottom'), 10) < 0) {
tempHeight = $footer.css('bottom');
$footer.css('bottom', 0);
} else {
$footer.css('bottom', tempHeight);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment