Last active
December 14, 2015 22:58
-
-
Save curtiswilkinson/705d2f90493a22bca2b8 to your computer and use it in GitHub Desktop.
Jquery slideToggle() accordion style menus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('.price-range-lg').hide(); | |
$('.price-range').hide(); | |
$('.filter').css('display','none'); | |
$('.filter-remove').each(function(){ | |
var showfilters = $(this).attr('data-filtercode'); | |
$('.filter-title[data-filtercode="'+showfilters+'"]').click(); | |
}); | |
}); | |
$('.filter-title').click(function(){ | |
var filtercode = $(this).attr('data-filtercode') | |
$('.filter[data-filtercode="'+filtercode+'"]').slideToggle(); | |
if ($("i", this).hasClass("fa-angle-down")) { | |
$("i", this).removeClass('fa-angle-down').addClass('fa-angle-up'); | |
} | |
else { | |
$("i", this).removeClass('fa-angle-up').addClass('fa-angle-down'); | |
} | |
}); | |
$('.filter-title[data-filtercode=price]').click(function(){ | |
$(this).next('.price-range').toggle(); | |
if ($("i", this).hasClass("fa-angle-down")) { | |
$("i", this).removeClass('fa-angle-down').addClass('fa-angle-up'); | |
} | |
else { | |
$("i", this).removeClass('fa-angle-up').addClass('fa-angle-down'); | |
} | |
}); | |
$('.filter-title[data-filtercode=price-lg]').click(function(){ | |
$(this).next('.price-range-lg').toggle(); | |
if ($("i", this).hasClass("fa-angle-down")) { | |
$("i", this).removeClass('fa-angle-down').addClass('fa-angle-up'); | |
} | |
else { | |
$("i", this).removeClass('fa-angle-up').addClass('fa-angle-down'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment