Skip to content

Commit d3271b9

Browse files
committed
Hide whole section through spoiler.
1 parent 18216ae commit d3271b9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎source/_static/spoilers.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
$(this).hide().data('hidden', true);
1717

18-
$(this).after('<button class="_show_hide" type="button">' + options.showText + '</button>');
18+
$(this).last().after('<button class="btn btn-warning _show_hide" type="button">' + options.showText + '</button>');
1919

2020
$('._show_hide').click(function () {
2121
var me = $(this);
22-
var el = $(this).prev();
22+
var el = $(this).prevUntil("h3");
2323
el.slideToggle(options.speed, function() {
2424
if (options.changeText) {
2525
if (el.data('hidden')) {
@@ -38,6 +38,6 @@
3838
(function ($) {
3939
$(document).ready(function() {
4040
'use strict';
41-
$(".solution h3").next().showHide();
41+
$(".solution h3").nextUntil("h3").showHide();
4242
});
4343
})(jQuery);

0 commit comments

Comments
 (0)