goto.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. // $(window).bind('scroll', function (e) {
  2. // parallaxScroll();
  3. // });
  4. // function parallaxScroll() {
  5. // var scrolled = $(window).scrollTop();
  6. // // 困擾
  7. // if (screen.width > 1024) {
  8. // $('#circle2').css('top', (300 - (scrolled * .2)) + 'px');
  9. // $('#circle3').css('top', (1000 - (scrolled * .2)) + 'px');
  10. // $('#circle1').css('top', (700 - (scrolled * .2)) + 'px');
  11. // // 課程大綱
  12. // // $('#act1').css('top', (30 + (scrolled * .1)) + 'px');
  13. // $('#act2').css('top', (900 - (scrolled * .2)) + 'px');
  14. // // $('#act3').css('top', (300 - (scrolled * .1)) + 'px');
  15. // $('#act4').css('top', (0 + (scrolled * .1)) + 'px');
  16. // $('#act5').css('top', (900 - (scrolled * .2)) + 'px');
  17. // } else {
  18. // }
  19. // }
  20. // 手機課程大綱輪播
  21. $("#card-box").slick({
  22. arrows: false,
  23. slidesToShow: 1,
  24. centerMode: true,
  25. infinite: false,
  26. dots: true,
  27. });
  28. // 手機課程大綱彈跳視窗
  29. // 視窗一
  30. $(".box-img01").click(function () {
  31. $(".mobile01-1").fadeIn();
  32. $(".mobile-box1").fadeIn();
  33. $(".card-box-1").slick({
  34. arrows: false,
  35. slidesToShow: 1,
  36. centerMode: true,
  37. infinite: false,
  38. dots: true,
  39. });
  40. });
  41. $(".close").click(function () {
  42. $(".mobile-box1").fadeOut();
  43. $(".mobile01-1").fadeOut();
  44. });
  45. // 視窗二
  46. $(".mobile01-2").fadeOut(0);
  47. $(".mobile-box2").fadeOut(0);
  48. $(".box-img02").click(function () {
  49. $(".mobile01-2").fadeIn();
  50. $(".mobile-box2").fadeIn();
  51. $(".card-box-2").slick({
  52. arrows: false,
  53. slidesToShow: 1,
  54. centerMode: true,
  55. infinite: false,
  56. dots: true,
  57. });
  58. });
  59. $(".close").click(function () {
  60. $(".mobile-box2").fadeOut();
  61. $(".mobile01-2").fadeOut();
  62. });
  63. // 視窗三
  64. $(".mobile01-3").fadeOut(0);
  65. $(".mobile-box3").fadeOut(0);
  66. $(".box-img03").click(function () {
  67. $(".mobile01-3").fadeIn();
  68. $(".mobile-box3").fadeIn();
  69. $(".card-box-3").slick({
  70. arrows: false,
  71. slidesToShow: 1,
  72. centerMode: true,
  73. infinite: false,
  74. dots: true,
  75. });
  76. });
  77. $(".close").click(function () {
  78. $(".mobile-box3").fadeOut();
  79. $(".mobile01-3").fadeOut();
  80. });
  81. // 手機課程日程輪播
  82. $("#card-box2").slick({
  83. arrows: false,
  84. slidesToShow: 1,
  85. centerMode: true,
  86. infinite: false,
  87. dots: true,
  88. });
  89. // 手機選單彈跳視窗
  90. $("#menu-box2").hide();
  91. $("#menu-box").hide();
  92. $("#menu-btn1").click(function () {
  93. $("#menu-box").slideToggle("slow");
  94. $("#menu-box2").slideToggle("slow");
  95. });
  96. $(".link").click(function () {
  97. $("#menu-box").slideUp("slow", function () {
  98. $("#menu-box2").slideUp("slow");
  99. // Animation complete.
  100. });
  101. });
  102. $("*").each(function (index, element) {
  103. // 此元素被點選後執行
  104. $(this).click(function (e) {
  105. // 取得被點選元素的屬性:data-gt-target
  106. var target = $(this).attr("data-gt-target");
  107. var duration = $(this).attr("data-gt-duration");
  108. var offset = $(this).attr("data-gt-offset");
  109. // JS 語法:判斷式
  110. // if (條件) {程式區塊}
  111. // 當條件成立,會執行程式區塊
  112. // 如果 目標有資料 才會執行 { } 內的程式
  113. // 避免出現 undefine (未定義 - 不存在的資料)
  114. if (target) {
  115. //console.log("目標:" + target);
  116. //console.log("時間:" + duration);
  117. //console.log("位移:" + offset);
  118. // 上方位置 = 目標區塊.位移().上方位置
  119. var top = $(target).offset().top;
  120. //console.log("要前往元素的上方位置:" + top);
  121. // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
  122. // parseInt() 將文字轉為數字
  123. $("html").stop().animate({
  124. scrollTop: top - offset
  125. }, parseInt(duration));
  126. }
  127. });
  128. });
  129. // 避免動畫與使用者滾輪衝突
  130. // html 在滾動滾輪時 停止 html 所有效果
  131. $("html").on("mousewheel", function () {
  132. $("html").stop();
  133. });
  134. // gotop下滑效果
  135. $(".arrow").hide();
  136. $(window).scroll(function () {
  137. var y = window.scrollY;
  138. if (y > 10) {
  139. $(".arrow").show();
  140. } else {
  141. $(".arrow").hide();
  142. }
  143. });
  144. // 電腦版表單
  145. $.fn.serializeObject = function () {
  146. var o = {};
  147. var a = this.serializeArray();
  148. $.each(a, function () {
  149. if (o[this.name]) {
  150. if (!o[this.name].push) {
  151. o[this.name] = [o[this.name]];
  152. }
  153. o[this.name].push(this.value || '');
  154. } else {
  155. o[this.name] = this.value || '';
  156. }
  157. });
  158. return o;
  159. };
  160. $(".contact-form").submit(function (e) {
  161. /* var formRef = $('#form1').serializeArray();
  162. var jsonString = JSON.stringify(formRef);*/
  163. var jsonInfo = $('.contact-form').serializeObject();
  164. var jsonString = JSON.stringify(jsonInfo);
  165. console.log(jsonString),
  166. $.ajax({
  167. type: 'POST',
  168. url: 'https://go.hhh.com.tw:8004/add_client_info',
  169. data: jsonString,
  170. dataType: 'json',
  171. success: function (data) {
  172. console.log('送出成功: ' + data);
  173. alert("送出成功");
  174. // if (data == 0) {
  175. // alert("送出成功");
  176. // } else if (data == 1) {
  177. // alert("此email已填過表單");
  178. // } else if (data == 2) {
  179. // alert("此phone已填過表單");
  180. // } else if (data == 3) {
  181. // alert("此email、phone已填過表單");
  182. // }
  183. location.reload();
  184. },
  185. beforeSend: function () {
  186. console.log('beforeSend');
  187. },
  188. complete: function () {
  189. console.log('complete');
  190. },
  191. error: function (jqXHR, textStatus, errorThrown) {
  192. console.log(JSON.stringify(jqXHR));
  193. console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
  194. console.log('送出失敗: ' + jqXHR.responseText);
  195. }
  196. });
  197. return false;
  198. });
  199. // 手機板表單
  200. $.fn.serializeObject = function () {
  201. var o = {};
  202. var a = this.serializeArray();
  203. $.each(a, function () {
  204. if (o[this.name]) {
  205. if (!o[this.name].push) {
  206. o[this.name] = [o[this.name]];
  207. }
  208. o[this.name].push(this.value || '');
  209. } else {
  210. o[this.name] = this.value || '';
  211. }
  212. });
  213. return o;
  214. };
  215. $(".contact-form2").submit(function (e) {
  216. /* var formRef = $('#form1').serializeArray();
  217. var jsonString = JSON.stringify(formRef);*/
  218. var jsonInfo = $('.contact-form2').serializeObject();
  219. var jsonString = JSON.stringify(jsonInfo);
  220. console.log(jsonString),
  221. $.ajax({
  222. type: 'POST',
  223. url: 'https://go.hhh.com.tw:8004/add_client_info',
  224. data: jsonString,
  225. dataType: 'json',
  226. success: function (data) {
  227. console.log('送出成功: ' + data);
  228. alert("送出成功");
  229. // if (data == 0) {
  230. // alert("送出成功");
  231. // } else if (data == 1) {
  232. // alert("此email已填過表單");
  233. // } else if (data == 2) {
  234. // alert("此phone已填過表單");
  235. // } else if (data == 3) {
  236. // alert("此email、phone已填過表單");
  237. // }
  238. location.reload();
  239. },
  240. beforeSend: function () {
  241. console.log('beforeSend');
  242. },
  243. complete: function () {
  244. console.log('complete');
  245. },
  246. error: function (jqXHR, textStatus, errorThrown) {
  247. console.log(JSON.stringify(jqXHR));
  248. console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
  249. console.log('送出失敗: ' + jqXHR.responseText);
  250. }
  251. });
  252. return false;
  253. });
  254. $(function () {
  255. $(".box1").hover(
  256. function () {
  257. $("#title1").html('課程1手機拍片');
  258. $("#title1-1").html('知名媒體網站電視台店長');
  259. },
  260. function () {
  261. $("#title1").html('課程1');
  262. $("#title1-1").html('手機拍片');
  263. })
  264. });
  265. $(function () {
  266. $(".box2").hover(
  267. function () {
  268. $("#title2").html('課程2社群營造');
  269. $("#title2-1").html('資深數位廣告投手');
  270. },
  271. function () {
  272. $("#title2").html('課程2');
  273. $("#title2-1").html('社群營造');
  274. })
  275. });
  276. $(function () {
  277. $(".box3").hover(
  278. function () {
  279. $("#title3").html('課程3文案撰寫');
  280. $("#title3-1").html('資深新聞媒體工作者');
  281. },
  282. function () {
  283. $("#title3").html('課程3');
  284. $("#title3-1").html('文案撰寫');
  285. })
  286. });
  287. // 電腦版彈跳視窗
  288. $("#Course-box01").fadeOut(0);
  289. $(".Course-box01").fadeOut(0);
  290. $("#Course-box02").fadeOut(0);
  291. $(".Course-box01").fadeOut(0);
  292. $("#Course-box03").fadeOut(0);
  293. $(".Course-box01").fadeOut(0);
  294. // 電腦版視窗一
  295. $(".box1").click(function () {
  296. $("#Course-box01").fadeIn();
  297. $(".Course-box01").fadeIn();
  298. });
  299. $(".close").click(function () {
  300. $("#Course-box01").fadeOut();
  301. $(".Course-box01").fadeOut();
  302. });
  303. // 電腦版視窗二
  304. $(".box2").click(function () {
  305. $("#Course-box02").fadeIn();
  306. $(".Course-box01").fadeIn();
  307. });
  308. $(".close").click(function () {
  309. $("#Course-box02").fadeOut();
  310. $(".Course-box01").fadeOut();
  311. });
  312. // 電腦版視窗三
  313. $(".box3").click(function () {
  314. $("#Course-box03").fadeIn();
  315. $(".Course-box01").fadeIn();
  316. });
  317. $(".close").click(function () {
  318. $("#Course-box03").fadeOut();
  319. $(".Course-box01").fadeOut();
  320. });
  321. (function () {
  322. const second = 1000,
  323. minute = second * 60,
  324. hour = minute * 60,
  325. day = hour * 24;
  326. let birthday = "Aug 23, 2021 00:00:00",
  327. countDown = new Date(birthday).getTime(),
  328. x = setInterval(function () {
  329. let now = new Date().getTime(),
  330. distance = countDown - now;
  331. var a = (distance / (day));
  332. var b = (distance % (day)) / (hour);
  333. var c = (distance % (hour)) / (minute);
  334. var d = (distance % (minute)) / (second);
  335. var hour1 = Math.floor(b);
  336. var result = hour1 < 10 ? '0' + hour1 : hour1;
  337. var second1 = Math.floor(d);
  338. var result2 = second1 < 10 ? '0' + second1 : second1;
  339. var minute1 = Math.floor(c);
  340. var result3 = minute1 < 10 ? '0' + minute1 : minute1;
  341. var day1 = Math.floor(a);
  342. var result4 = day1 < 10 ? '0' + day1 : day1;
  343. document.getElementById("days").innerText = result4,
  344. document.getElementById("hours").innerText = result,
  345. document.getElementById("minutes").innerText = result3,
  346. document.getElementById("seconds").innerText = result2;
  347. //do something later when date is reached
  348. //seconds
  349. }, 0)
  350. }());