Skip to content

Commit

Permalink
Merge pull request #52 from jhelvy/pingfan-ui-design
Browse files Browse the repository at this point in the history
Update hide_pages.js
  • Loading branch information
pingfan-hu authored Aug 5, 2024
2 parents 58857f1 + e4f577d commit 40e5b67
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 40e5b67

Please sign in to comment.