123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- // 手機板menu彈跳視窗
- $("#menu-box2").hide();
- $("#menu-box").hide();
- $(".link").click(function () {
- $("#menu-box").fadeOut("slow", function () {
- $("#menu-box2").fadeOut("slow");
- // Animation complete.
- });
- });
- $("#menu-btn1").click(function () {
- $("#menu-box").fadeIn();
- $("#menu-box2").fadeIn();
- });
- $(".close").click(function () {
- $("#menu-box").fadeOut();
- $("#menu-box2").fadeOut();
- });
- // sec01 最新課程手機輪播
- $('#sec01-moblie-container').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: false,
- centerMode: true,
- });
- $('#sec01-slider-next').click(function () {
- $('#sec01-moblie-container').slick('slickNext')
- });
- // sec04 專欄報導 手機輪播
- $('#sec04-moblie-container').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: false,
- centerMode: true,
- });
- $('#sec04-slider-next').click(function () {
- $('#sec04-moblie-container').slick('slickNext')
- });
- // sec03排名table輪播
- $('#sec03-slider').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: true,
- });
- $('#sec03-slider-next').click(function () {
- $('#sec03-slider').slick('slickNext')
- });
- $("*").each(function (index, element) {
- // 此元素被點選後執行
- $(this).click(function (e) {
- // 取得被點選元素的屬性:data-gt-target
- var target = $(this).attr("data-gt-target");
- var duration = $(this).attr("data-gt-duration");
- var offset = $(this).attr("data-gt-offset");
- // JS 語法:判斷式
- // if (條件) {程式區塊}
- // 當條件成立,會執行程式區塊
- // 如果 目標有資料 才會執行 { } 內的程式
- // 避免出現 undefine (未定義 - 不存在的資料)
- if (target) {
- //console.log("目標:" + target);
- //console.log("時間:" + duration);
- //console.log("位移:" + offset);
- // 上方位置 = 目標區塊.位移().上方位置
- var top = $(target).offset().top;
- //console.log("要前往元素的上方位置:" + top);
- // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
- // parseInt() 將文字轉為數字
- $("html").stop().animate({
- scrollTop: top - offset
- }, parseInt(duration));
- }
- });
- });
- // 避免動畫與使用者滾輪衝突
- // html 在滾動滾輪時 停止 html 所有效果
- $("html").on("mousewheel", function () {
- $("html").stop();
- });
- // 點擊次數增加JS
- $(document).on("click", ".course-src", function (event) {
- var courseid = $(this).data("info");
- console.log(courseid);
- var url = "https://welife.asia:8002/course_click/" + courseid + "";
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url);
- xhr.setRequestHeader("accept", "application/json");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- console.log(xhr.status);
- console.log(xhr.responseText);
- }
- };
- xhr.send();
- });
- $.fn.serializeObject = function () {
- var o = {};
- var a = this.serializeArray();
- // o["id"] = 0;
- // o["time_stamp"] = "";
- $.each(a, function () {
- if (o[this.name]) {
- if (!o[this.name].push) {
- o[this.name] = [o[this.name]];
- }
- o[this.name].push(this.value || '');
- } else {
- o[this.name] = this.value || '';
- }
- });
- return o;
- };
- $(".email-sub").submit(function (e) {
- /* var formRef = $('#form1').serializeArray();
- var jsonString = JSON.stringify(formRef);*/
- var jsonInfo = $('.email-sub').serializeObject();
- tag_str = ''
- jsonInfo.tags.forEach(function (value) {
- tag_str += value + ',';
- });
- jsonInfo.tags = tag_str.slice(0, -1);
- var jsonString = JSON.stringify(jsonInfo);
- console.log(jsonString),
- $.ajax({
- type: 'POST',
- url: 'https://welife.asia:8002/email_interest',
- data: jsonString,
- dataType: 'json',
- success: function (data) {
- console.log('送出成功: ' + data);
- alert("訂閱成功");
- location.reload();
- },
- beforeSend: function () {
- console.log('beforeSend');
- },
- complete: function () {
- console.log('complete');
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log(JSON.stringify(jqXHR));
- console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
- console.log('送出失敗: ' + jqXHR.responseText);
- }
- });
- return false;
- });
- $( ".close-adv" ).click(function() {
- $( ".courseadv" ).hide();
- });
- // $('.sec05-course').slick({
- // slidesToShow: 4,
- // slidesToScroll: 4,
- // infinite: true,
- // arrows: true,
- // });
- // $('.sec05-course2').slick({
- // slidesToShow: 3,
- // slidesToScroll: 3,
- // infinite: true,
- // arrows: true,
- // });
- function getParameterByName(name, url = window.location.href) {
- name = name.replace(/[\[\]]/g, '\\$&');
- var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- }
- var id = getParameterByName('id');
- console.log(id);
- function get_data() {
- // var desid2=String(desid);
- // console.log(desid2);
- // $("#version").val(desid);
- // $("#version").html(desid);
- $.ajax({
- method: "GET",
- url: "article.json",
- dataType: "json",
- })
- .done(function (msg) {
- for (var i = 0; i <msg.length; i++) {
- if(msg[i].id==id){
- var contentarticle = '';
- var webtitle = '';
- console.log(msg);
- contentarticle += ' \
- <h1 class="sec10-title">\
- '+msg[i].articletitle+' \
- </h1>\
- <p class="card-text"><small class="text-muted">By'+msg[i].articleauthor+'</small></p>\
- <img class="m-1" style="width: 20px;" src="./img/time.png" alt=""><span>'+msg[i].articledate+'</span>\
- <hr>\
- <a target="_blank" href="https://testnets.akaswap.com/akaobj/251">\
- <img class="img-fluid" src="'+msg[i].articleimg+'" alt="">\
- </a>\
- <!-- 文章內容 -->\
- <div class="sec10-content mt-3">\
- '+msg[i].artuclecontent+'\
- </div>';
- webtitle += ' \
- '+ msg[i].articletitle + '';
- }
- $('#webtitle').html(webtitle);
- $('.content').html(contentarticle);
- }
- });
- }
- get_data();
- // window.onload = function () {
- // $.ajax({
- // method: "GET",
- // url: "article.json",
- // dataType: "json",
- // })
- // .done(function (msg) {
- // var contentarticle = '';
- // console.log(msg);
- // var res = msg.length;
- // console.log(res);
- // const limit = res;
- // for (var i = 0; i < limit; i++) {
- // contentarticle += ' \
- // <h1 class="sec10-title">\
- // '+msg[i].articletitle+' \
- // </h1>\
- // <p class="card-text"><small class="text-muted">By'+msg[i].articleauthor+'</small></p>\
- // <img class="m-1" style="width: 20px;" src="./img/time.png" alt=""><span>'+msg[i].articledate+'</span>\
- // <hr>\
- // <a target="_blank" href="https://testnets.akaswap.com/akaobj/251">\
- // <img class="img-fluid" src="'+msg[i].articleimg+'" alt="">\
- // </a>\
- // <!-- 文章內容 -->\
- // <div class="sec10-content mt-3">\
- // '+msg[i].artuclecontent+'\
- // </div>';
-
- // }
- // $('.content').html( contentarticle);
- // });
- // }
- //影片播放
- $('.btn-close').click(function() {
- $('.youtube-video').each(function() {
- this.contentWindow.postMessage('{"event": "command", "func": "stopVideo", "args": ""}', '*');
- });
- });
- $('#exampleModal').click(function() {
- $('.youtube-video').each(function() {
- this.contentWindow.postMessage('{"event": "command", "func": "stopVideo", "args": ""}', '*');
- });
- });
- $('.stopplay').click(function() {
- document.getElementById("videotest").pause();
- });
- $('#exampleModal1').click(function() {
- document.getElementById("videotest").pause();
-
- });
|