
FAIR is a non-profit organization dedicated to providing well-documented answers to criticisms of the doctrine, practice, and history of The Church of Jesus Christ of Latter-day Saints.
MikeParker (talk | contribs) No edit summary |
MikeParker (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
// COLLAPSIBLE HEADER | // COLLAPSIBLE HEADER - improved (arrow left + CSS rotate) | ||
$(document).ready(function () { | $(document).ready(function () { | ||
$(".collapsible-header").each(function () { | $(".collapsible-header").each(function () { | ||
| Line 10: | Line 10: | ||
if (content.length === 0) return; | if (content.length === 0) return; | ||
// Check if the section should start open | // Check if the section should start open (template may add class "open") | ||
var startsOpen = header.hasClass("open"); | var startsOpen = header.hasClass("open"); | ||
| Line 16: | Line 16: | ||
if (!startsOpen) { | if (!startsOpen) { | ||
content.hide(); | content.hide(); | ||
} else { | |||
// ensure the header has the open class in case it's needed | |||
header.addClass("open"); | |||
} | } | ||
// | // Always use the same arrow character and rotate with CSS | ||
// Prepend so the arrow appears before the header text | |||
header. | header.prepend('<span class="collapse-toggle" aria-hidden="true">▼</span>'); | ||
// Make header clickable | // Make header clickable | ||
| Line 28: | Line 31: | ||
header.on("click", function () { | header.on("click", function () { | ||
content.slideToggle(200); | content.slideToggle(200); | ||
header.toggleClass("open"); | header.toggleClass("open"); | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
/* Any JavaScript here will be loaded for all users on every page load. */
// COLLAPSIBLE HEADER - improved (arrow left + CSS rotate)
$(document).ready(function () {
$(".collapsible-header").each(function () {
var header = $(this);
var content = header.next(".collapsible-content");
// Skip if there is no associated collapsible-content block
if (content.length === 0) return;
// Check if the section should start open (template may add class "open")
var startsOpen = header.hasClass("open");
// Hide content only if it should start closed
if (!startsOpen) {
content.hide();
} else {
// ensure the header has the open class in case it's needed
header.addClass("open");
}
// Always use the same arrow character and rotate with CSS
// Prepend so the arrow appears before the header text
header.prepend('<span class="collapse-toggle" aria-hidden="true">▼</span>');
// Make header clickable
header.css("cursor", "pointer");
// Collapse / Expand behavior
header.on("click", function () {
content.slideToggle(200);
header.toggleClass("open");
});
});
});

FAIR is a non-profit organization dedicated to providing well-documented answers to criticisms of the doctrine, practice, and history of The Church of Jesus Christ of Latter-day Saints.
We are a volunteer organization. We invite you to give back.
Donate Now