// let over = document.querySelector('.infoContent .tab-content').offsetHeight+600; const navCollapse = document.querySelector('#nav-collapse'); const navCollapse2 = document.querySelector('.scroll-nav-collapse'); if (screen.width < 600) { // window.location.href = `./index_designerList.html?cid=${cid}`; let over = document.querySelector('.infoContent .tab-content').offsetHeight+500; function fixedOnOver() { if(window.pageYOffset >= over){ navCollapse.classList.add('sticky'); } else { navCollapse.classList.remove('sticky'); } } } else{ let over = document.querySelector('.infoContent .tab-content').offsetHeight+600; function fixedOnOver() { if(window.pageYOffset >= over){ navCollapse.classList.add('sticky'); navCollapse2.classList.add('pt-5') } else { navCollapse.classList.remove('sticky'); navCollapse2.classList.remove('pt-5') } } } window.addEventListener('scroll', fixedOnOver); // function fixedOnOver() { // if(window.pageYOffset >= over){ // navCollapse.classList.add('sticky'); // } else { // navCollapse.classList.remove('sticky'); // } // } function scrollTest() { let page = 2; let cardData; let is_update = 0; $(window).scroll(function() { if($(window).scrollTop() + $(window).height() >= ($(document).height() - 400) && is_update == 0) { is_update = 1; if(is_update == 1) { $.ajax({ method: "GET", url: `https://m3.hhh.com.tw:18686/gencase?id=14151&sort=new&page=${page}`, headers: {'accept': 'application/json'} }).done(function (msg) { $('.CaseNews-Card').append(CaseNews); if(cardData.length > 0) { is_update = 0; page ++; } else { is_update = 1; } }); } } }) }