I have looked around and around and I can't find or figure this out. Maybe I have seen something but wasn't sure how to integrate it into what I have...I'm not sure. I have decided to swallow my pride and ask. I am new to Javascript/jquery and I am stuck.
I have created a row of buttons that all slideDown a panel. I have all of the buttons working correctly with one thing missing. I would like only one panel to be open at a time. So, if one panel was open and I clicked on another button the open panel will slideUp and the next will slideDown.
If my scripting is a little ruff, any critique is much appreciated as well.
Thank you.
The link to the site is http://greenmountainfarmtoschool.org/dev_site/
And my jQuery:
jQuery(function ($) {
$(document).ready(function() {
$(function () {
$('.action-btn').on('click', function () {
var sliderID = $(this).attr('data-sliderid');
if ($('.' + sliderID).is(":hidden")) {
$('.' + sliderID).slideDown("slow");
}
if($(div).hasClass('down')) {
.slideUp("slow");
}
else {
$('.' + sliderID).slideUp("slow");
}
});
});
});//end of docready
$(window).load(function() { });//end of windowload
});//end of $ block
jQuery(function ($) {
Another approach would be to use jQuery UI tabs and just style them since they already implement the behavior you want.