histroy.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. (function () {
  2. 'use strict';
  3. // modal.style.display = "none";
  4. // 建立模态框对象
  5. var modalBox = {};
  6. // 获取模态框
  7. modalBox.modal = document.getElementById("myModal");
  8. modalBox.modalpic = document.getElementById("myModalpic");
  9. // 获得按钮
  10. modalBox.triggerBtn = document.getElementById("triggerBtn");
  11. modalBox.triggerBtnpic = document.getElementById('triggerBtnpic')
  12. // 获得关闭按钮
  13. modalBox.closeBtn = document.getElementById("closeBtn");
  14. modalBox.closeBtnpic = document.getElementById("closeBtnpic");
  15. // 模态框显示
  16. modalBox.show = function () {
  17. // $("#data-content-line").load(location.href + "#data-content-line");
  18. $("#data-content-line").load(location.href + "#data-content-line");
  19. this.modal.style.display = "block";
  20. }
  21. modalBox.showpic = function () {
  22. $('#myModalpic').show();
  23. }
  24. // 模态框关闭
  25. modalBox.close = function () {
  26. this.modal.style.display = "none";
  27. }
  28. modalBox.closepic = function () {
  29. $('#myModalpic').hide();
  30. }
  31. // 模态框初始化
  32. modalBox.init = function () {
  33. var that = this;
  34. this.triggerBtn.onclick = function () {
  35. that.show();
  36. }
  37. this.triggerBtnpic.onclick = function () {
  38. that.showpic();
  39. }
  40. this.closeBtn.onclick = function () {
  41. that.close();
  42. }
  43. this.closeBtnpic.onclick = function () {
  44. that.closepic();
  45. }
  46. }
  47. modalBox.init();
  48. })()