Skip to content

Instantly share code, notes, and snippets.

@paulkmiller
Created November 29, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulkmiller/edf6350f42bade263bd4a561f5745ee5 to your computer and use it in GitHub Desktop.
Save paulkmiller/edf6350f42bade263bd4a561f5745ee5 to your computer and use it in GitHub Desktop.
// TODO: Holy fuck so many selectors, send help and towels
$(document).on('click', '.listings li .info', function(e) {
$listings = $('.listings');
$listingsCard = $('.listings li.top');
$table = $('table');
$footer = $('footer');
// condition ? value-if-true : value-if-fale
// if ($('.viewport .listings').has('.listings-full')) { keep '.expanded' from being removed } else { keep keeping '.expanded' from being removed }
$listings.toggleClass('listings-full');
$listingsCard.toggleClass('full expanded');
$table.toggleClass('show');
$footer.toggleClass('show');
if ($listings.hasClass('listings-full')) {
$listings.addClass('listings-full');
$listingsCard.addClass('full expanded');
$table.addClass('show');
$footer.addClass('show');
} else {
$listings.removeClass('listings-full');
$listingsCard.removeClass('full');
$table.removeClass('show');
$footer.removeClass('show');
}
return false
});
$(document).on('click', '.listings li.top', function(target, e) {
$this = $(this);
$table = $('table');
$footer = $('footer');
$this.toggleClass('expanded');
$table.toggleClass('show');
$footer.toggleClass('show');
if ($this.hasClass('expanded')) {
$this.addClass('expanded');
$table.addClass('show');
$footer.addClass('show');
} else {
$this.removeClass('expanded');
$table.removeClass('show');
$footer.removeClass('show');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment