12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- let over = document.querySelector('.infoContent .tab-content').offsetHeight+200;
- window.addEventListener('scroll', fixedOnOver);
-
- const navCollapse = document.querySelector('#nav-collapse');
-
- 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;
- }
- });
- }
- }
- })
- }
|