footer.jsp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <footer>
  3. <div class="count"></div>
  4. <section>
  5. <a class="f-logo">평택시 교통정보센터</a>
  6. <p>
  7. <a href="https://www.pyeongtaek.go.kr/pyeongtaek/contents.do?mId=0702010000" target="_blank" rel="noopener noreferrer">개인정보처리방침</a>
  8. <a href="https://www.pyeongtaek.go.kr/pyeongtaek/contents.do?mId=0703000000" target="_blank" rel="noopener noreferrer">이메일수집거부</a>
  9. </p>
  10. <p>경기도 평택시 죽백동 죽백4로 21</p>
  11. <p>평택시 대표/민원 문의 : 031-8024-5000, 교통정보센터 홈페이지 문의 : 031-8053-1536</p>
  12. <p>Copyright ⓒ PYEONGTAEK Regional Construction of Management Office.<span>All rights reserved.</span></p>
  13. </section>
  14. <div class="incd-scroll-box"></div>
  15. </footer>
  16. <script type="text/javascript">
  17. footerInterval();
  18. var initInterval;
  19. var incdRollingTimer;
  20. function footerInterval() {
  21. getVisitCount();
  22. getRollingIncdData();
  23. if (initInterval) clearInterval(initInterval);
  24. initInterval = setInterval(()=>{
  25. footerInterval();
  26. }, 5 * 60 * 1000);
  27. }
  28. function getRollingIncdData() {
  29. $.ajax({
  30. type: "POST",
  31. dataType: 'json',
  32. contentType: 'application/json; charset=utf-8',
  33. url: '/common/getIncdOcrr.do',
  34. success : function (data) {
  35. const pathname = window.location.pathname;
  36. const isShow = pathname === '/main/main.do' || pathname === '/traffic/incd.do';
  37. if (isShow) {
  38. if (_IncdOcrrArr.length) {
  39. _IncdOcrrArr.forEach((obj)=>{
  40. obj.incdMarker.setMap(null);
  41. });
  42. _IncdOcrrArr = [];
  43. }
  44. if (_IncdInfoWindow) {
  45. _IncdInfoWindow.setMap(null);
  46. _IncdInfoWindow = null;
  47. }
  48. if (_IncdOverlay) {
  49. _IncdOverlay.setMap(null);
  50. _IncdOverlay = null;
  51. }
  52. }
  53. let str = '';
  54. if (data.length <= 0) {
  55. str = '<div class="incd-empty">돌발 상황 없음</div>';
  56. }
  57. else {
  58. for (let obj of data) {
  59. if (!obj) {
  60. continue;
  61. }
  62. const {
  63. incd_ocrr_id,
  64. link_id,
  65. incd_strt_dt,
  66. incd_end_prar_dt,
  67. road_name,
  68. incd_titl,
  69. incd_expl,
  70. incd_type_code,
  71. cmmn_cd_kor_nm,
  72. x_crdn,
  73. y_crdn
  74. } = obj;
  75. if (isShow) {
  76. _IncdOcrrArr.push(new _IncdOcrrObj(
  77. incd_ocrr_id,
  78. link_id,
  79. incd_strt_dt,
  80. incd_end_prar_dt,
  81. road_name,
  82. incd_titl,
  83. incd_expl,
  84. incd_type_code,
  85. cmmn_cd_kor_nm,
  86. x_crdn,
  87. y_crdn
  88. ));
  89. }
  90. str +=`
  91. <div class="incd-box"
  92. onmouseover="stopRolling()"
  93. onmouseleave="footerRolling(\${data.length})"
  94. onclick="incdClick('\${incd_ocrr_id}')"
  95. title="\${incd_titl}">
  96. <div class="incd-scroll-title">\${incd_titl}</div>
  97. <div class="incd-scroll-container">
  98. <div>
  99. <div>설명 : </div>
  100. <div>\${incd_expl}</div>
  101. </div>
  102. <p>기간 : \${incd_strt_dt}
  103. - \${incd_end_prar_dt}</p>
  104. </div>
  105. </div>`;
  106. }
  107. footerRolling(data.length);
  108. }
  109. if (isShow) {
  110. showIncd();
  111. }
  112. $('.incd-scroll-box').html(str);
  113. },
  114. error : function (err) {
  115. alert('getIncdOcrr ajax error');
  116. }
  117. })
  118. }
  119. function stopRolling() {
  120. // clearInterval(incdRollingTimer);
  121. cancelAnimationFrame(incdRollingTimer);
  122. }
  123. function incdClick(id) {
  124. if (_InciFlag) {
  125. $('#inciInfo').click();
  126. }
  127. _IncdOcrrArr.forEach((item)=>{
  128. if (item.incd_ocrr_id === id) {
  129. item.incdClickEvt();
  130. }
  131. })
  132. }
  133. let idx = 1;
  134. function footerRolling(length) {
  135. let margin = 90;
  136. if (length > 1) {
  137. if (incdRollingTimer) cancelAnimationFrame(incdRollingTimer);
  138. // if (incdRollingTimer) clearInterval(incdRollingTimer);
  139. // incdRollingTimer = setInterval(()=>{
  140. // const scrollBox = $('.incd-scroll-box');
  141. // if (document.hasFocus()) {
  142. // scrollBox.animate({
  143. // marginTop : '-'+margin +'px',
  144. // }, 500, ()=>{
  145. // scrollBox.children().eq(0).appendTo(scrollBox);
  146. // scrollBox.css('margin-top', 0);
  147. // });
  148. // }
  149. // }, 3000);
  150. let start = new Date().getTime();
  151. function rolling() {
  152. let ts = new Date().getTime();
  153. if (ts - 3000 >= start) {
  154. const scrollBox = $('.incd-scroll-box');
  155. scrollBox.animate({
  156. marginTop : '-'+margin +'px',
  157. }, 500, ()=>{
  158. scrollBox.children().eq(0).appendTo(scrollBox);
  159. scrollBox.css('margin-top', 0);
  160. });
  161. start = new Date().getTime();
  162. }
  163. incdRollingTimer = requestAnimationFrame(rolling);
  164. }
  165. incdRollingTimer = requestAnimationFrame(rolling);
  166. }
  167. }
  168. </script>