Skip to content

Commit

Permalink
Update hide_pages.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pingfan-hu committed Aug 5, 2024
1 parent 0537dca commit e4f577d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inst/example/simple/_extensions/surveydown/hide_pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Define a global function to hide all pages
window.hideAllPages = function() {
var pages = document.querySelectorAll("div.sd-page");
var pages = document.querySelectorAll("div[class*='sd-page'], section[class*='sd-page']");
pages.forEach(function(page) {
page.style.display = 'none';
});
Expand All @@ -9,5 +9,8 @@ window.hideAllPages = function() {
// Call the function on initial load to hide all pages except the first
document.addEventListener("DOMContentLoaded", function() {
window.hideAllPages();
document.querySelectorAll("div.sd-page")[0].style.display = 'block';
var firstPage = document.querySelector("div[class*='sd-page'], section[class*='sd-page']");
if (firstPage) {
firstPage.style.display = 'block';
}
});

0 comments on commit e4f577d

Please sign in to comment.