// $(".popular").hide(); $(document).on("click", ".likeSee__state__filter--item", function (event) { // $(".News").toggle(); // $(".popular").toggle(); $(".likeSee__state__filter--item").removeClass('active'); $(this).addClass("active"); }); const urlParams = new URLSearchParams(window.location.search); let id = urlParams.get('cid'); console.log(id); function get_data() { $.ajax({ method: "GET", url: `json/Columns-${id}.json`, // url:`json/Columns.json`, dataType: "json", }) .done(function (msg) { console.log(msg); let ColumnsContent = ""; let ColumnsTag = ""; let breadcrumbTitle = ""; let article_info = ""; let OtherColumns = ""; let PopularColumns = ""; breadcrumbTitle = `${msg[0].Columnstitle}` article_info = `

${msg[0].Columnstitle}

${msg[0].ColumnsDate}| 人氣:${msg[0].ColumnsViews}
`; ColumnsContent = `${msg[0].ColumnsContent}`; for (let j = 0; j < msg[0].ColumnsTag.length; j++) { ColumnsTag += ' \ ' + msg[0].ColumnsTag[j].Tag + ''; } for (let i = 0; i < 12; i++) { OtherColumns += '
\ \
\ \
\ '+ msg[0].OtherColumns[i].Columnstitle + '\
\
' OtherColumns += '

' for (k = 0; k < msg[0].OtherColumns[i].ColumnsTag.length; k++) { OtherColumns += '\ ' + msg[0].OtherColumns[i].ColumnsTag[k].Tag + '' } OtherColumns += '

' OtherColumns += '
' } // for(let i=0; i
\ // \ //
\ // \ //
\ // '+msg[0].PopularColumns[i].Columnstitle+'\ //
\ //
' // PopularColumns+='

' // for(k=0; k'+msg[0].PopularColumns[i].ColumnsTag[k].Tag+'' // } // PopularColumns+='

' // PopularColumns+='
' // } $('.article_info').html(article_info); $('.breadcrumb-title').html(breadcrumbTitle); $('.ColumnsContent').html(ColumnsContent); $('.ColumnsTag').html(ColumnsTag); $('.OtherColumns').html(OtherColumns); // $('.PopularColumns').html(PopularColumns); }); } function renderSec07() { $.ajax({ method: "GET", // url: `json/bannerAds-${id}.json`, url: `json/bannerAds.json`, dataType: "json", }) .done(function (msg) { console.log(msg); let str = ''; for (let i = 0; i < msg[0].data.length; i++) { // console.log(msg[i]) str += `
` } $(`.sec-07__slider`).html(str); $(".sec-07__slider").slick({ dots: false, autoplay: true, arrows: true, slidesToShow: 1, slidesToScroll: 1, autoplaySpeed: 7000, initialSlide: 0, infinite: true, prevArrow: '', nextArrow: '' }); }); } get_data(); renderSec07(); $(".views").click(function () { get_views_data(); }); $(".recently").click(function () { get_data(); }); function get_views_data() { $.ajax({ method: "GET", url: `json/Columns-${id}.json`, // url:`json/cases.json`, dataType: "json", }) .done(function (msg) { console.log(msg); let OtherColumns = ""; msg[0].OtherColumns.sort(function (a, b) { return a['Views'] > b['Views'] ? -1 : 1; }); console.log(msg[0].OtherColumns); for (let i = 0; i < msg[0].OtherColumns.length; i++) { OtherColumns += '
\ \
\ \
\ '+ msg[0].OtherColumns[i].Columnstitle + '\
\
' OtherColumns += '

' for (k = 0; k < msg[0].OtherColumns[i].ColumnsTag.length; k++) { OtherColumns += '\ ' + msg[0].OtherColumns[i].ColumnsTag[k].Tag + '' } OtherColumns += '

' OtherColumns += '
' } $('.OtherColumns').html(OtherColumns); }); }; // $(document).ready(function () { // var h = $('#hhh-cases').height(); // var sh = $('#hhh-cases').scrollHeight; // var st = $('#hhh-cases').scrollTop; // console.log(h); // console.log(sh); // console.log(st); // $('#hhh-cases').scroll(function () { // var h = $(this).height(); // var st = $(this).scrollTop; // console.log(h); // console.log(sh); // console.log(st); // if(h+st>= sh){ // alert('底部了') // } // }); // }); $(document).ready(function() { $(window).scroll(function() { if ($(document).scrollTop()<=0){ // alert("滾動條已經到達頂部爲0"); } if ($(document).scrollTop() >= $(document).height() - $(window).height()) { // alert("滾動條已經到達底部爲" + $(document).scrollTop()); } }); });