带Bootstrap 4和本地存储 活动日历

  • 源码大小:8.19KB
  • 所需积分:1积分
  • 源码编号:19JP-3271
  • 浏览次数:727次
  • 最后更新:2023年05月25日
  • 所属栏目:时间和时钟
本站默认解压密码:19jp.com 或 19jp_com

简介

一个响应迅速、移动友好的月历组件,使用JavaScript(jQuery)和Bootstrap 4框架构建。

单击日期以添加或删除您的活动。事件使用HTML5本地存储存储在本地。

如何使用它:

1.在HTML文档中加载必要的jQuery和Bootstrap。

  1. <link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" />
  2. <script src="/path/to/cdn/jquery.slim.min.js"></script>
  3. <script src="/path/to/cdn/bootstrap.min.js"></script>

2.创建一个容器来存放活动日历。

  1. <div id="app"></div>

3.在Bootstrap的JavaScript之后加载主事件日历脚本。

  1. <script src="js/script.js"></script>

4.活动日历所需的CSS样式。

  1. html body .card {
  2. border-radius: 15px;
  3. overflow: hidden
  4. }
  5.  
  6. html body .card-header {
  7. background: #5c3037;
  8. color: #fff
  9. }
  10.  
  11. html body .card-header .prevMonth {
  12. cursor: pointer
  13. }
  14.  
  15. html body .card-header .nextMonth {
  16. cursor: pointer
  17. }
  18.  
  19. html body .card-body {
  20. background: #f1acb7
  21. }
  22.  
  23. html body .card-body .days span {
  24. background: #e27586;
  25. color: #fff;
  26. border-radius: 50%;
  27. display: inline-block;
  28. height: 45px;
  29. width: 45px;
  30. line-height: 45px;
  31. cursor: pointer
  32. }
  33.  
  34. html body .card-body .days span:hover {
  35. background: #f7899a
  36. }
  37.  
  38. html body .card-body .dates span {
  39. background: #f4bdc6;
  40. color: #000;
  41. border-radius: 50%;
  42. display: inline-block;
  43. height: 45px;
  44. width: 45px;
  45. line-height: 45px;
  46. cursor: pointer
  47. }
  48.  
  49. html body .card-body .dates span.active,
  50. html body .card-body .dates span:hover {
  51. background: #ffeef0;
  52. color: #000
  53. }
  54.  
  55. html body .card-body .dates span.ntMonth {
  56. color: #938e8e;
  57. background: #ffd8de
  58. }
  59.  
  60. html body .card-body .dates span.ntMonth:hover {
  61. background: #ffeef0;
  62. color: #000
  63. }
  64.  
  65. html body .card#event .card-header .close {
  66. color: #fff;
  67. opacity: 1
  68. }
  69.  
  70. html body .card#event .card-body .events-today {
  71. height: 210px;
  72. overflow-x: hidden
  73. }
  74.  
  75. html body .card#event .card-body .events-input .data-invalid {
  76. border-color: red
  77. }
  78.  
  79. html body .card#event .card-body .events-input .error {
  80. font-size: 12px;
  81. color: red;
  82. position: absolute;
  83. top: 100%
  84. }
  85.  
  86. @media(max-width: 767px) {
  87. html body .card-body .days span {
  88. height: 38px;
  89. width: 38px;
  90. line-height: 38px;
  91. font-size: .8rem
  92. }
  93. html body .card-body .dates span {
  94. height: 38px;
  95. width: 38px;
  96. line-height: 38px;
  97. font-size: .8rem
  98. }
  99. html body .card#event .card-body .events-today {
  100. height: 188px
  101. }
  102. }

更新日志:

2022-12-05

  • 错误修复

预览截图