You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930
  1. $(function () {
  2. let loadHtmlArr = [
  3. "cover",
  4. // "catalog",
  5. "preface",
  6. "section_1",
  7. "section_2",
  8. "section_3",
  9. "section_4",
  10. ];
  11. $(".pdf_root").html(loadHtmlArr.map(htmlName => {
  12. return `<div class="${htmlName}_html_root"></div>`;
  13. }).join(""));
  14. loadHtmlArr.forEach(htmlName => {
  15. if (htmlName === "preface") {
  16. $(`.${htmlName}_html_root`).data("page-params", JSON.stringify({
  17. htmlName,
  18. subjectname: "语文",
  19. num: 12
  20. }));
  21. } else if (htmlName === "section_1") {
  22. $(`.${htmlName}_html_root`).data("page-params", JSON.stringify({
  23. htmlName,
  24. subjectname: "数学",
  25. num: 33
  26. }));
  27. }
  28. $(`.${htmlName}_html_root`).load(`../sections/${htmlName}.html`);
  29. });
  30. });