goto.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. // sec03排名table輪播
  2. $('#sec03-slider').slick({
  3. arrows: false,
  4. slidesToShow: 1,
  5. slidesToScroll: 1,
  6. infinite:false,
  7. });
  8. // sec05 熱門作品 手機輪播
  9. $('#sec05-moblie-slider').slick({
  10. arrows: false,
  11. slidesToShow: 1,
  12. slidesToScroll: 1,
  13. infinite:true,
  14. });
  15. // sec05桌機輪播
  16. $('#sec05-destop-slider').slick({
  17. arrows: true,
  18. slidesToShow: 3,
  19. slidesToScroll: 3,
  20. infinite:true,
  21. });
  22. // sec06桌機輪波
  23. // $('#sec06-container').slick({
  24. // arrows: true,
  25. // slidesToShow: 4,
  26. // slidesToScroll: 3,
  27. // infinite:true,
  28. // });
  29. $(function(){
  30. $('#sec06-container').slick({
  31. arrows: false,
  32. slidesToShow: 4,
  33. slidesToScroll: 3,
  34. infinite:true,
  35. responsive: [
  36. {
  37. breakpoint: 600, // RWD在1024寬度時切換顯示數量
  38. settings: {
  39. slidesToShow: 1, //一次顯示3個
  40. slidesToScroll: 1,//切換下一頁時移動3個
  41. }
  42. },{
  43. breakpoint: 600,// RWD在600寬度時切換顯示數量
  44. settings: {
  45. slidesToShow: 1,//一次顯示2個
  46. slidesToScroll: 1,//切換下一頁時移動2個
  47. }
  48. },
  49. ]
  50. });
  51. })
  52. // sec04 洞察報告 手機輪播
  53. $('#sec04-moblie-container').slick({
  54. arrows: false,
  55. slidesToShow: 1,
  56. slidesToScroll: 1,
  57. infinite:false,
  58. centerMode: true,
  59. });
  60. // 手機板menu彈跳視窗
  61. $("#menu-box2").hide();
  62. $("#menu-box").hide();
  63. $(".link").click(function () {
  64. $("#menu-box").fadeOut("slow", function () {
  65. $("#menu-box2").fadeOut("slow");
  66. // Animation complete.
  67. });
  68. });
  69. $("#menu-btn1").click(function () {
  70. $("#menu-box").fadeIn();
  71. $("#menu-box2").fadeIn();
  72. });
  73. $(".close").click(function () {
  74. $("#menu-box").fadeOut();
  75. $("#menu-box2").fadeOut();
  76. });
  77. $("*").each(function (index, element) {
  78. // 此元素被點選後執行
  79. $(this).click(function (e) {
  80. // 取得被點選元素的屬性:data-gt-target
  81. var target = $(this).attr("data-gt-target");
  82. var duration = $(this).attr("data-gt-duration");
  83. var offset = $(this).attr("data-gt-offset");
  84. // JS 語法:判斷式
  85. // if (條件) {程式區塊}
  86. // 當條件成立,會執行程式區塊
  87. // 如果 目標有資料 才會執行 { } 內的程式
  88. // 避免出現 undefine (未定義 - 不存在的資料)
  89. if (target) {
  90. //console.log("目標:" + target);
  91. //console.log("時間:" + duration);
  92. //console.log("位移:" + offset);
  93. // 上方位置 = 目標區塊.位移().上方位置
  94. var top = $(target).offset().top;
  95. //console.log("要前往元素的上方位置:" + top);
  96. // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
  97. // parseInt() 將文字轉為數字
  98. $("html").stop().animate({
  99. scrollTop: top - offset
  100. }, parseInt(duration));
  101. }
  102. });
  103. });
  104. // 避免動畫與使用者滾輪衝突
  105. // html 在滾動滾輪時 停止 html 所有效果
  106. $("html").on("mousewheel", function () {
  107. $("html").stop();
  108. });
  109. $(".sec03-table-title").addClass("contant-toggle");
  110. $("#sec03-slider").on('beforeChange', function (event, slick, currentSlide, nextSlide) {
  111. console.log('beforeChangeEvent: currenSlide=' + currentSlide + ', nextSlide= ' + nextSlide);
  112. if (nextSlide == 1) {
  113. $(".sec03-table-title").removeClass("contant-toggle");
  114. $(".sec03-table-title2").addClass("contant-toggle");
  115. }
  116. else if (nextSlide == 0) {
  117. $(".sec03-table-title2").removeClass("contant-toggle");
  118. $(".sec03-table-title").addClass("contant-toggle");
  119. }
  120. });
  121. // 電腦版email
  122. $.fn.serializeObject = function () {
  123. var o = {};
  124. var a = this.serializeArray();
  125. // o["id"] = 0;
  126. // o["time_stamp"] = "";
  127. $.each(a, function () {
  128. if (o[this.name]) {
  129. if (!o[this.name].push) {
  130. o[this.name] = [o[this.name]];
  131. }
  132. o[this.name].push(this.value || '');
  133. } else {
  134. o[this.name] = this.value || '';
  135. }
  136. });
  137. return o;
  138. };
  139. $(".contact-form-destop").submit(function (e) {
  140. /* var formRef = $('#form1').serializeArray();
  141. var jsonString = JSON.stringify(formRef);*/
  142. var jsonInfo = $('.contact-form-destop').serializeObject();
  143. var jsonString = JSON.stringify(jsonInfo);
  144. console.log(jsonString),
  145. $.ajax({
  146. type: 'GET',
  147. url: 'http://172.105.205.52:8003/get_sub_list',
  148. data: jsonString,
  149. dataType: 'json',
  150. success: function (data) {
  151. console.log('送出成功: ' + data);
  152. alert("送出成功");
  153. // if (data == 0) {
  154. // alert("送出成功");
  155. // } else if (data == 1) {
  156. // alert("此email已填過表單");
  157. // } else if (data == 2) {
  158. // alert("此phone已填過表單");
  159. // } else if (data == 3) {
  160. // alert("此email、phone已填過表單");
  161. // }
  162. // location.reload();
  163. },
  164. beforeSend: function () {
  165. console.log('beforeSend');
  166. },
  167. complete: function () {
  168. console.log('complete');
  169. },
  170. error: function (jqXHR, textStatus, errorThrown) {
  171. console.log(JSON.stringify(jqXHR));
  172. console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
  173. console.log('送出失敗: ' + jqXHR.responseText);
  174. }
  175. });
  176. return false;
  177. });
  178. // 手機板 email
  179. $.fn.serializeObject = function () {
  180. var o = {};
  181. var a = this.serializeArray();
  182. $.each(a, function () {
  183. if (o[this.name]) {
  184. if (!o[this.name].push) {
  185. o[this.name] = [o[this.name]];
  186. }
  187. o[this.name].push(this.value || '');
  188. } else {
  189. o[this.name] = this.value || '';
  190. }
  191. });
  192. return o;
  193. };
  194. $(".contact-form-mobile").submit(function (e) {
  195. /* var formRef = $('#form1').serializeArray();
  196. var jsonString = JSON.stringify(formRef);*/
  197. var jsonInfo = $('.contact-form-mobile').serializeObject();
  198. var jsonString = JSON.stringify(jsonInfo);
  199. console.log(jsonString),
  200. $.ajax({
  201. type: 'GET',
  202. url: 'http://172.105.205.52:8003/get_sub_list',
  203. data: jsonString,
  204. dataType: 'json',
  205. success: function (data) {
  206. console.log('送出成功: ' + data);
  207. alert("送出成功");
  208. // if (data == 0) {
  209. // alert("送出成功");
  210. // } else if (data == 1) {
  211. // alert("此email已填過表單");
  212. // } else if (data == 2) {
  213. // alert("此phone已填過表單");
  214. // } else if (data == 3) {
  215. // alert("此email、phone已填過表單");
  216. // }
  217. location.reload();
  218. },
  219. beforeSend: function () {
  220. console.log('beforeSend');
  221. },
  222. complete: function () {
  223. console.log('complete');
  224. },
  225. error: function (jqXHR, textStatus, errorThrown) {
  226. console.log(JSON.stringify(jqXHR));
  227. console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
  228. console.log('送出失敗: ' + jqXHR.responseText);
  229. }
  230. });
  231. return false;
  232. });