goto.js 11 KB

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