Hi there.
i have 4 buttons and each one shoul triger different hidden row. But when the user clicks on a button, the script should show him only the row associated with that button,and close the other rows.
I’m using this code right now but all the rows remain open if i click, it doesn-t close the previous one.
jQuery(document).ready(function($){
$(’.section-expandable’).slideToggle(0);
$(’.section-trigger’).on(‘click’,function(e){
e.preventDefault();
$(’.section-expandable’).slideToggle(‘slow’);
$(‘html, body’).animate({
scrollTop: $(".section-expandable").offset().top
}, 700, ‘swing’);
});
});
jQuery(document).ready(function($){
$(’.section-expandable-1’).slideToggle(0);
$(’.section-trigger-1’).on(‘click’,function(e){
e.preventDefault();
$(’.section-expandable-1’).slideToggle(‘slow’);
$(‘html, body’).animate({
scrollTop: $(".section-expandable-1").offset().top
}, 700, ‘swing’);
});
});
And same section-expandable-3 and 4 for the third and fourth button.
Thank you.