1// 02 å¤´æ¡æ»å¾ 2$(function () { 3 // åå§åé»è®¤ç¶æ 4 $(".hot-News-hd a").eq(0).addClass("on"); 5 $(".hot-News-switch .hot-News-box .hot-News-bd").eq(0).show(); 6 7 // é¼ æ æ¬å忢å表项 8 $(".hot-News-switch .list a").on("mouseover", function () { 9 const $this = $(this); 10 const index = $this.index(); 11 12 $this.addClass("on").siblings().removeClass("on"); 13 $this.parent().prev().find(".thumb").eq(index).show().siblings().hide(); 14 15 const $thumb = $this.parent().prev().find(".thumb").eq(index); 16 if ($thumb.children("video").length) { 17 $this.parents(".hot-News-bd").addClass("video-bd"); 18 } else { 19 $this.parents(".hot-News-bd").removeClass("video-bd"); 20 } 21 }); 22 23 // tab 忢 & åå§å Swiper 24 const tabNames = [ 25 "swiper-tuijian", "swiper-shenzhen", "swiper-shipin", 26 "swiper-zhibo", "swiper-zhuanti", "swiper-jiaoyu", 27 "swiper-fangchan", "swiper-caijing", "swiper-xiaofei", "swiper-jiankang" 28 ]; 29 30 const paginationClasses = [ 31 ".swiper-pagination1", ".swiper-pagination2", ".swiper-pagination3", 32 ".swiper-pagination4", ".swiper-pagination5", ".swiper-pagination6", 33 ".swiper-pagination7", ".swiper-pagination8", ".swiper-pagination9", ".swiper-pagination10" 34 ]; 35 36 const navNexts = [ 37 '.swiper-button-next1', '.swiper-button-next2', '.swiper-button-next3', 38 '.swiper-button-next4', '.swiper-button-next5', '.swiper-button-next6', 39 '.swiper-button-next7', '.swiper-button-next8', '.swiper-button-next9', '.swiper-button-next10' 40 ]; 41 42 const navPrevs = [ 43 '.swiper-button-prev1', '.swiper-button-prev2', '.swiper-button-prev3', 44 '.swiper-button-prev4', '.swiper-button-prev5', '.swiper-button-prev6', 45 '.swiper-button-prev7', '.swiper-button-prev8', '.swiper-button-prev9', '.swiper-button-prev10' 46 ]; 47 48 let swipers = {}; 49 50 $(".hot-News-hd a").on("mouseover", function () { 51 const $this = $(this); 52 const index = $this.index(); 53 54 $this.addClass("on").siblings().removeClass("on"); 55 56 const $target = $(".hot-News-switch .hot-News-box .hot-News-bd").eq(index).show().siblings().hide(); 57 58 const containerClass = "." + tabNames[index]; 59 const paginationClass = paginationClasses[index]; 60 const navNext = navNexts[index]; 61 const navPrev = navPrevs[index]; 62 63 if (swipers[tabNames[index]]) { 64 return; 65 } 66 67 // åå§å Swiper 68 swipers[tabNames[index]] = new Swiper(containerClass, { 69 loop: true, 70 navigation: { 71 nextEl: navPrev, 72 prevEl: navNext, 73 }, 74 pagination: { 75 el: paginationClass, 76 clickable: true, 77 renderBullet: function (i, className) { 78 return '<span class="' + className + '">' + (i + 1) + "</span>"; 79 }, 80 }, 81 on: { 82 init: function () { 83 console.log(tabNames[index] + ' åå§å宿'); 84 }, 85 transitionEnd: function () { 86 $("video").trigger("pause"); 87 $(".swiper-video-controls").attr( 88 "src", 89 "https://www.sznews.com/2025/images/index_play.png" 90 ); 91 }, 92 }, 93 }); 94 }); 95 96 // è§é¢ææ¾æ§å¶ 97 function setupVideoControls() { 98 $(".swiper-slide video, .swiper-slide .swiper-video-controls").on("click", function () { 99 const $video = $(this).is("video") ? $(this) : $(this).siblings("video"); 100 const $img = $(this).siblings("img"); 101 102 if ($video[0].paused) { 103 $("video").trigger("pause"); 104 $video.trigger("play"); 105 $img.attr("src", "https://www.sznews.com/2025/images/index_pause.png"); 106 } else { 107 $("video").trigger("pause"); 108 $img.attr("src", "https://www.sznews.com/2025/images/index_play.png"); 109 } 110 }); 111 } 112 113 setupVideoControls(); 114 115 // ç§»å¨ç«¯è·³è½¬é»è¾ 116 window.linkTo = function (type) { 117 const mobileLinks = { 118 'æ·±å³': 'https://m.sznews.com/node_309276.htm?chanid=309276', 119 'ç´æ': 'https://news.sznews.com/mb/node_141128.htm', 120 'ä¸é¢': 'https://news.sznews.com/mb/node_237796.htm' 121 }; 122 123 const isMobile = /phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|fennec|wosbrowser|browserng|webos|symbian|windows phone/i.test(navigator.userAgent); 124 125 if (isMobile && mobileLinks[type]) { 126 window.open(mobileLinks[type]); 127 } else { 128 const link = $('.hot-News-hd .on').attr('href'); 129 window.open(link); 130 } 131 }; 132 133 // â æ°å¢ï¼é¡µé¢å è½½å®æåç«å³åå§å第ä¸ä¸ª tab ç Swiper 134 const initSwiperOnLoad = function () { 135 const index = 0; 136 const containerClass = "." + tabNames[index]; 137 const paginationClass = paginationClasses[index]; 138 const navNext = navNexts[index]; 139 const navPrev = navPrevs[index]; 140 141 if (!swipers[tabNames[index]]) { 142 swipers[tabNames[index]] = new Swiper(containerClass, { 143 loop: true, 144 navigation: { 145 nextEl: navPrev, 146 prevEl: navNext, 147 }, 148 pagination: { 149 el: paginationClass, 150 clickable: true, 151 renderBullet: function (i, className) { 152 return '<span class="' + className + '">' + (i + 1) + "</span>"; 153 }, 154 }, 155 on: { 156 init: function () { 157 console.log(tabNames[index] + ' åå§å宿'); 158 }, 159 transitionEnd: function () { 160 $("video").trigger("pause"); 161 $(".swiper-video-controls").attr( 162 "src", 163 "https://www.sznews.com/2025/images/index_play.png" 164 ); 165 }, 166 }, 167 }); 168 } 169 }; 170 171 // å»¶è¿æ§è¡ Swiper åå§åï¼ç¡®ä¿ DOM å·²å è½½å®æ 172 $(window).on("load", function () { 173 initSwiperOnLoad(); 174 }); 175}); 176 177 178//æ·±æ¥å大工ä½å®¤ ä¸»æ æ´»é¡µå¤¹åæ¢ 179 180document.addEventListener('DOMContentLoaded', function () { 181 // åå§åSwiperå®ä¾ 182 var swiperGzs = new Swiper('.gzs-swiper', { 183 slidesPerView: 7, 184 spaceBetween: 20, 185 navigation: { 186 nextEl: '.gzs-next', 187 prevEl: '.gzs-prev', 188 }, 189 }); 190 191 var swiperZb = new Swiper('.zb-swiper', { 192 slidesPerView: 6, 193 spaceBetween: 10, 194 navigation: { 195 nextEl: '.zb-next', 196 prevEl: '.zb-prev', 197 }, 198 }); 199 200 const tabs = document.querySelectorAll('.mod-tit');
201 tabs.forEach(tab => { 202 tab.addEventListener('click', function () { 203 // ç§»é¤æætabçæ¿æ´»ç¶æ 204 tabs.forEach(t => t.classList.remove('active-tab')); 205 // æ·»å å½åtabçæ¿æ´»ç¶æ 206 this.classList.add('active-tab'); 207 208 // è·åç®æ å 容åºID 209 const targetClass = this.getAttribute('data-target'); 210 211 // éèææå å®¹åº 212 document.querySelectorAll('.mod-bd .swiper-sb').forEach(content => content.classList.remove('active')); 213 // æ¾ç¤ºç®æ å å®¹åº 214 document.querySelector(`.${targetClass}`).classList.add('active'); 215 216 // éèæææé®ç» 217 document.querySelectorAll('.sbqh div').forEach(buttonGroup => buttonGroup.classList.remove('active')); 218 // æ¾ç¤ºç®æ æé®ç» - ä¿®æ£éæ©å¨ 219 document.querySelector(`.${targetClass}-${targetClass}`).classList.add('active'); 220 221 // éæ°åå§åå¹¶æ´æ°å½åSwiperå®ä¾ 222 if (targetClass === 'gzs') { 223 swiperGzs.update(); 224 } else { 225 swiperZb.update(); 226 } 227 }); 228 }); 229 230 // åå§å第ä¸ä¸ªtabä¸ºæ¿æ´»ç¶æ 231 if (tabs.length > 0) { 232 const firstTab = tabs[0]; 233 const targetClass = firstTab.getAttribute('data-target'); 234 235 // 1. æ¿æ´» tab æé® 236 firstTab.classList.add('active-tab'); 237 238 // 2. æ¿æ´»ä¸»ç®æ å 容 (ä¿®å¤æ½å¨ null) 239 const targetElement = document.querySelector(`.${targetClass}`); 240 if (targetElement) { 241 targetElement.classList.add('active'); 242 } 243
244 // 3. æ¿æ´»åµå¥ç®æ (ä¿®å¤æ½å¨ null) 245 const nestedElement = document.querySelector(`.${targetClass}-${targetClass}`); 246 if (nestedElement) { 247 nestedElement.classList.add('active'); 248 } 249 } 250 251 252}); 253 254 255//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////æ·±ç½åç 256document.addEventListener('DOMContentLoaded', function () { 257 const tabsContainer = document.getElementById('tabsContainer'); 258 const prevBtn = document.getElementById('prevBtn'); 259 const nextBtn = document.getElementById('nextBtn'); 260 const tabBtns = document.querySelectorAll('.tabSliderTabButton'); 261 const contentDivs = document.querySelectorAll('.tabSliderContentPanel'); 262 263 // 临æ¶å¼å ³ï¼æ§å¶æ¯å¦ç¦ç¨å 容忢 264 const TEMPORARY_DISABLE_CONTENT_SWITCH = true; 265 266 let scrollAmount = 0; 267 let currentIndex = 0; // å½åç´¢å¼ä»ç¨äºæ»å¨é»è¾ï¼ä¸å½±åé«äº® 268 const TABS_PER_PAGE = 8; // æ¯æ¬¡åæ¢çæ ç¾æ°é 269 let maxScroll = 0; 270 const TAB_MARGIN = 0.09; // æ ç¾é´é (rem) 271 272 // è·åæ ¹å ç´ çåä½å¤§å°ï¼ç¨äºremæ¢ç®ï¼ 273 function getRootFontSize() { 274 return parseFloat(getComputedStyle(document.documentElement).fontSize); 275 } 276 277 // è·åå个æ ç¾ç宽度ï¼åä½ï¼remï¼ 278 function getTabWidthInRem() { 279 if (tabBtns.length === 0) return 0; 280 return tabBtns[0].getBoundingClientRect().width / getRootFontSize(); 281 } 282 283 // è·åå å«é´éçæ»æ ç¾å®½åº¦ï¼åä½ï¼remï¼ 284 function getTotalTabWidthInRem() { 285 return getTabWidthInRem() + TAB_MARGIN; 286 } 287 288 // æ´æ°æ»å¨è®¡ç®ç¸å ³çå¼ 289 function updateScrollMetrics() { 290 const totalTabWidth = getTotalTabWidthInRem(); 291 maxScroll = Math.max(0, Math.ceil(tabBtns.length / TABS_PER_PAGE) - 1) * TABS_PER_PAGE * totalTabWidth; 292 scrollAmount = Math.min(scrollAmount, maxScroll); 293 } 294 295 // æ ¹æ®å±å¹å®½åº¦è®¡ç®å¯è§æ ç¾æ°éï¼ä¿æååºå¼ï¼ 296 function calculateVisibleTabs() { 297 const windowWidth = window.innerWidth; 298 const rootFontSize = getRootFontSize(); 299 const containerWidth = tabsContainer.getBoundingClientRect().width / rootFontSize; 300 const totalTabWidth = getTotalTabWidthInRem(); 301 302 const calculatedVisibleTabs = Math.floor(containerWidth / totalTabWidth); 303 304 return Math.min( 305 calculatedVisibleTabs, 306 windowWidth < 640 ? 3 : 307 windowWidth < 768 ? 4 : 308 windowWidth < 1024 ? 6 : TABS_PER_PAGE 309 ); 310 } 311 312 // åå§å 313 updateScrollMetrics(); 314 setActiveTab(0); // åå§å第ä¸ä¸ªæ ç¾ 315 updateButtonVisibility(); 316 317 // æ ç¾ç¹å»äºä»¶ï¼ç¹å»å䏿¹åé«äº®ï¼åªå¤çæ»å¨ï¼ 318 tabBtns.forEach((btn, index) => { 319 btn.addEventListener('click', () => { 320 setActiveTab(index); // ä»è§¦åé»è¾ï¼ä½é«äº®åªä¿ç第ä¸ä¸ª 321 }); 322 }); 323 324 // åä¸é¡µæé®ç¹å»äºä»¶ 325 prevBtn.addEventListener('click', () => { 326 const newIndex = Math.max(0, currentIndex - TABS_PER_PAGE); 327 if (newIndex !== currentIndex) { 328 setActiveTab(newIndex); 329 scrollByPage(-1); 330 } 331 }); 332 333 // åä¸é¡µæé®ç¹å»äºä»¶ 334 nextBtn.addEventListener('click', () => { 335 const newIndex = Math.min(tabBtns.length - 1, currentIndex + TABS_PER_PAGE); 336 if (newIndex !== currentIndex) { 337 setActiveTab(newIndex); 338 scrollByPage(1); 339 } 340 }); 341 342 // 设置活å¨ç¶æï¼æ ¸å¿ä¿®æ¹ï¼åªè®©ç¬¬ä¸ä¸ªæ ç¾ä¿æé«äº®ï¼ 343 function setActiveTab(index) { 344 currentIndex = index; // 仿´æ°å½åç´¢å¼ç¨äºæ»å¨ï¼ä½ä¸å½±åé«äº® 345 346 // éç½®æææ ç¾æ ·å¼ 347 tabBtns.forEach(tab => { 348 tab.classList.remove('tabSliderTabButtonActive'); 349 tab.classList.add('tabSliderTabButtonInactive'); 350 }); 351 352 // åºå®åªè®©ç¬¬ä¸ä¸ªæ ç¾ï¼ç´¢å¼0ï¼é«äº® 353 tabBtns[0].classList.remove('tabSliderTabButtonInactive'); 354 tabBtns[0].classList.add('tabSliderTabButtonActive'); 355 356 // å 容忢é»è¾ï¼ä¿æåé»è¾ï¼ 357 if (!TEMPORARY_DISABLE_CONTENT_SWITCH || index === 0) {
358 contentDivs.forEach(div => { 359 div.classList.remove('tabSliderContentActive'); 360 }); 361 contentDivs[index].classList.add('tabSliderContentActive'); 362 } 363 364 updateButtonState(); 365 } 366 367 // æé¡µæ»å¨ 368 function scrollByPage(direction) { 369 const totalTabWidth = getTotalTabWidthInRem(); 370 const pageWidth = TABS_PER_PAGE * totalTabWidth; 371 let newScrollAmount = scrollAmount + (direction * pageWidth); 372 newScrollAmount = Math.max(0, Math.min(newScrollAmount, maxScroll)); 373 374 if (newScrollAmount !== scrollAmount) { 375 scrollAmount = newScrollAmount; 376 tabsContainer.style.transform = `translateX(-${scrollAmount * getRootFontSize()}px)`; 377 } 378 } 379 380 // ç¡®ä¿æ ç¾å¯è§ 381 function ensureTabVisible(index) { 382 const totalTabWidth = getTotalTabWidthInRem(); 383 const tabPosition = index * totalTabWidth; 384 const pageWidth = TABS_PER_PAGE * totalTabWidth; 385 386 const currentPage = Math.floor(scrollAmount / pageWidth); 387 const targetPage = Math.floor(tabPosition / pageWidth);
388 389 if (currentPage !== targetPage) { 390 scrollAmount = targetPage * pageWidth; 391 tabsContainer.style.transform = `translateX(-${scrollAmount * getRootFontSize()}px)`; 392 } 393 } 394 395 // æ´æ°æé®ç¶æ 396 function updateButtonState() { 397 prevBtn.disabled = currentIndex === 0; 398 nextBtn.disabled = currentIndex >= tabBtns.length - TABS_PER_PAGE; 399 prevBtn.classList.toggle('disabled', prevBtn.disabled); 400 nextBtn.classList.toggle('disabled', nextBtn.disabled); 401 } 402 403 // æ´æ°æé®å¯è§æ§ 404 function updateButtonVisibility() { 405 const visibleTabs = calculateVisibleTabs(); 406 const shouldHideButtons = tabBtns.length <= visibleTabs; 407 prevBtn.style.display = shouldHideButtons ? 'none' : 'flex'; 408 nextBtn.style.display = shouldHideButtons ? 'none' : 'flex'; 409 } 410 411 // ååºå¼å¤ç 412 function handleResize() { 413 updateScrollMetrics(); 414 ensureTabVisible(currentIndex); 415 updateButtonVisibility(); 416 } 417 418 // çå¬åä½å¤§å°åå 419 function observeFontSizeChanges() { 420 const observer = new MutationObserver(handleResize); 421 observer.observe(document.documentElement, { 422 attributes: true, 423 attributeFilter: ['style', 'class'] 424 }); 425 } 426 427 window.addEventListener('resize', handleResize); 428 observeFontSizeChanges(); 429}); 430//////////////////////////////////////////////////////////////////////////////////////////////////////////äº§ç»æ»å¾ 431var swiper = new Swiper('.cjnews-one-scroll', { 432 navigation: { 433 nextEl: '.swiper-button-next', 434 prevEl: '.swiper-button-prev', 435 }, 436 autoplay: true, 437 loop: true, 438}); 439 440 441 442////////////////////////////////////////////////////////////////////////////////æ¶æ¿å¿«æ¥/////////// å®ç°12æ¡æ°é»åä¸¤ç»æ»å¨ï¼ä¿æé´è·ä¸è´ 443(function () { 444 // è·åå ç´ 445 const container = document.querySelector('.politics-scroll-container'); 446 const wrapper = document.querySelector('.politics-scroll-wrapper'); 447 const originalList = document.getElementById('originalList'); 448 449 // 容å¨é«åº¦ååç»é«åº¦ 450 const containerHeight = container.offsetHeight; 451 const groupSize = 6; // æ¯ç»6æ¡ 452 453 // å¤å¶åå§å表åå»ºå®æ´å¾ªç¯ 454 const fullCopy = originalList.cloneNode(true); 455 fullCopy.id = 'fullCopy'; 456 wrapper.appendChild(fullCopy); 457 458 // è®¡ç®æ»ç»æ° 459 const totalItems = originalList.querySelectorAll('li').length; 460 const totalGroups = totalItems / groupSize; // 12æ¡å³2ç» 461 462 // 忢忰 463 let currentGroup = 0; 464 const switchInterval = 5000; // 忢é´éæ¶é´(ms) 465 const animationDuration = 500; // å¨ç»æç»æ¶é´(ms) 466 let isAnimating = false; 467 let autoSwitchTimer; 468 469 // 忢尿å®ç» 470 function switchToGroup(index) { 471 if (isAnimating) return; 472 473 isAnimating = true; 474 // è®¡ç®æ»å¨è·ç¦»ï¼æ¯ç»é«åº¦ = 容å¨é«åº¦ï¼ 475 const scrollDistance = index * containerHeight; 476 477 wrapper.style.transition = `transform ${animationDuration}ms ease-in-out`; 478 wrapper.style.transform = `translateY(-${scrollDistance}px)`; 479 480 setTimeout(() => { 481 isAnimating = false; 482 currentGroup = index; 483 484 // æ ç¼å¾ªç¯å¤ç 485 if (currentGroup >= totalGroups) { 486 setTimeout(() => { 487 wrapper.style.transition = 'none'; 488 wrapper.style.transform = 'translateY(0)'; 489 currentGroup = 0; 490 }, 100); 491 } 492 }, animationDuration); 493 } 494 495 // èªå¨åæ¢å°ä¸ä¸ç» 496 function switchToNextGroup() { 497 let nextGroup = currentGroup + 1; 498 switchToGroup(nextGroup); 499 } 500 501 // èªå¨åæ¢æ§å¶ 502 function startAutoSwitch() { 503 autoSwitchTimer = setInterval(switchToNextGroup, switchInterval); 504 } 505 506 function pauseAutoSwitch() { 507 clearInterval(autoSwitchTimer); 508 } 509 510 // é¼ æ äº¤äº 511 container.addEventListener('mouseenter', pauseAutoSwitch); 512 container.addEventListener('mouseleave', startAutoSwitch); 513 514 // åå§å 515 startAutoSwitch(); 516})(); 517///////////////////////////////////////////////////////////////////////////////////////////////é¢å¯¼ä¸ç3个banneræ»å¾ 518function AutoScroll(obj) { 519 var str = obj.replace(/#/g, ""); 520 var height_gd = document.getElementById(str).offsetHeight; 521 $(obj) 522 .find("ul:first") 523 .animate( 524 { 525 //åä¸ç§»å¨è·ç¦»çäºå¾çé« 526 marginTop: "-" + height_gd + "px", 527 }, 528 500, 529 function () { 530 $(this) 531 .css({ marginTop: "0px" }) 532 .find("li:first") 533 .appendTo(this); 534 } 535 ); 536} 537// å¨é¡µé¢å è½½å®æåå¯å¨æææ»å¨ 538$(function () { 539 //setInterval('AutoScroll("#list")', 3000); 540 //setInterval('AutoScroll("#list1")', 3000); 541 setInterval('AutoScroll("#list2")', 3000); // 3000表示3ç§æ»å¨ä¸æ¬¡ 542}); 543
544//////////////////////////////////////////////////////////////////////////////////产ç»å³ä¾§å表æ å¾ä¸æ¾ç¤º 545// çå¾ DOMå è½½å®æ 546document.addEventListener('DOMContentLoaded', function () { 547 // è·åæææ°é»æ¡ç® 548 const newsItems = document.querySelectorAll('.cjnews-three a'); 549 550 newsItems.forEach(item => { 551 const imgContainer = item.querySelector('.huod-img'); 552 const img = item.querySelector('.huod-img img'); 553 const textContent = item.querySelector('.text-content'); 554 555 // æ£æ¥å¾çæ¯å¦ææ 556 if (!img || !isValidImageUrl(img.src)) { 557 // éèå¾çå®¹å¨ 558 if (imgContainer) { 559 imgContainer.style.display = 'none'; 560 } 561 562 // 让æåå å®¹å æ»¡æ´æ 563 if (textContent) { 564 textContent.style.width = '100%'; 565 textContent.style.margin = '0'; 566 // å¯ä»¥æ ¹æ®éè¦æ·»å æ´å¤æ ·å¼ 567 } 568 } 569 }); 570 571 // æ£æ¥å¾çURLæ¯å¦ææçç®åæ¹æ³ 572 function isValidImageUrl(url) { 573 const imgExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp']; 574 const lowerUrl = url.toLowerCase(); 575 return imgExtensions.some(ext => lowerUrl.endsWith(ext)); 576 } 577}); 578 579 580///////////////////////////////////////////////////////////////////////////////////////////////ææºç phone 581//02æ¨èæ»å¾ 582var swiper = new Swiper('.tuijian-phone', { 583 autoplay: true, 584 pagination: { 585 el: '.tuijian-gt .swiper-pagination', 586 }, 587}); 588 589//è§é¢æ»å¾01 590// 使ç¨IIFEå°è£ ï¼å建ç¬ç«ä½ç¨å 591(function () { 592 // çå¾ DOMå è½½å®æ 593 document.addEventListener('DOMContentLoaded', function () { 594 // æ£æ¥å®¹å¨æ¯å¦åå¨ï¼é¿å é误 595 const container = document.querySelector('.phone-viedo-one'); 596 if (!container) return; 597 598 // 使ç¨å±é¨åéï¼ä¸æ±¡æå ¨å± 599 const phoneViedoSwiper = new Swiper(container, { 600 slidesPerView: 2.3, 601 slideWidth: 2.95 * 100, // ä¿æä¸CSSä¸è´ï¼1rem=100pxï¼ 602 spaceBetween: 10, 603 autoplay: false, 604 loop: false, 605 freeMode: false, 606 centeredSlides: false, 607 initialSlide: 0, 608 slidesPerGroup: 1, 609 610 resistance: false, 611 resistanceRatio: 0, 612 613 observer: true, 614 observeParents: true, 615 watchSlidesProgress: true, 616 watchSlidesVisibility: true, 617 618 touchRatio: 1, 619 touchAngle: 45, 620 simulateTouch: true, 621 622 // ä½¿ç¨æ´å ·ä½çéæ©å¨ï¼éå®å¨å½å容å¨å 623 navigation: { 624 nextEl: '.phone-viedo-one .swiper-button-next', 625 prevEl: '.phone-viedo-one .swiper-button-prev', 626 }, 627 628 on: { 629 init: function () { 630 this.updateSize(); 631 const slideWidth = 2.95 * 100; 632 633 // æ£æ¥ container æ¯å¦åå¨ä¸æå ç´ 634 if (!this.container || this.container.length === 0) { 635 console.warn('Slider init failed: container element not found or empty.'); 636 return; 637 } 638 639 const $container = this.container[0]; // è·ååç DOM å ç´ 640 // 忬¡æ£æ¥æ¯å¦ä¸ºææç DOM å ç´ 641 if (!$container.offsetWidth) { 642 console.warn('Slider init failed: container has no width (may not be rendered yet).'); 643 return; 644 } 645 646 const containerWidth = this.container[0].offsetWidth; 647 648 this.targetTranslate = -(slideWidth - (containerWidth - (slideWidth * 2 + this.spaceBetween))); 649 650 const firstSlideVisibleRatio = 1 - (Math.abs(this.targetTranslate) / slideWidth); 651 console.log('æ»å¨å第ä¸ä¸ªslideå¯è§æ¯ä¾:', firstSlideVisibleRatio.toFixed(2)); 652 }, 653 654 slideChangeTransitionEnd: function () { 655 if (this.activeIndex >= 1) { 656 this.setTranslate(this.targetTranslate); 657 } 658 }, 659 660 setTranslate: function (translate) { 661 const minTranslate = Math.min(0, this.targetTranslate); 662 const limitedTranslate = Math.max(translate, minTranslate); 663 this.$el.transform(`translate3d(${limitedTranslate}px, 0, 0)`); 664 } 665 } 666 });
667 668 // å¦éå¤é¨è®¿é®ï¼éè¿å®¹å¨çèªå®ä¹å±æ§æè½½ï¼èéå ¨å±åé 669 container.swiperInstance = phoneViedoSwiper; 670 }); 671})(); 672//è§é¢æ»å¾02 673// åå§åSwiper 674var mySwiper = new Swiper('.phone-viedo-two', { 675 slidesPerView: 1.2, // ä¸é´1ä¸ªå®æ´æ¾ç¤ºï¼ä¸¤ä¾§åæ¾ç¤ºçº¦0.15 676 centeredSlides: true, // ä¸é´å¹»ç¯çå± ä¸ 677 loop: true, // å¼å¯æ é循ç¯ï¼æ ç¼è¡æ¥æ ¸å¿ï¼ 678 loopAdditionalSlides: 2, // é¢å¤å¤å¶2个幻ç¯çç¨äºæ ç¼è¡æ¥ 679 speed: 600, // ç¨æ ¢çéåº¦è®©è¿æ¸¡æ´èªç¶ 680 spaceBetween: 15, // å¹»ç¯çé´è· 681 autoplay: { 682 delay: 3000, 683 disableOnInteraction: false 684 }, 685 simulateTouch: true, 686 grabCursor: true, 687 // è§£å³å¾ªç¯æ¶å¯è½åºç°ç空ç½é®é¢ 688 observer: true, // çæµå®¹å¨åå 689 observeParents: true, // çæµç¶å ç´ åå 690 navigation: { 691 nextEl: '.swiper-button-next', 692 prevEl: '.swiper-button-prev', 693 }, 694 // æ·»å å页å¨é ç½® 695 pagination: { 696 el: '.tuijian-sp-two .swiper-pagination', // ç»å®å页å¨å®¹å¨ 697 clickable: true, // å 许ç¹å»å页å¨åæ¢å¹»ç¯ç 698 dynamicBullets: true, // 卿大å°çå页å¨ï¼å¯éï¼è§è§æææ´å¥½ï¼ 699 dynamicMainBullets: 3 // 卿å页卿¾ç¤ºçæå¤§ bullets æ°éï¼å¯éï¼ 700 }, 701 // æ»å¨ç»æåç¡®ä¿æ£ç¡®çä½ç½® 702 on: { 703 slideChangeTransitionEnd: function () { 704 // ç¡®ä¿å¨å¾ªç¯æ¨¡å¼ä¸æ£ç¡®æ´æ°æ´»å¨å¹»ç¯ç 705 if (this.isEnd) { 706 this.slideTo(this.slides.length - this.loopAdditionalSlides * 2, 0, false); 707 } else if (this.isBeginning) { 708 this.slideTo(this.loopAdditionalSlides, 0, false); 709 } 710 } 711 } 712}); 713 714//è§é¢æ»å¾03 715// 使ç¨å½å空é´åä¸¥æ ¼æ¨¡å¼è¿ä¸æ¥é离 716(function (win, doc) { 717 'use strict'; 718 719 // å¯ä¸æ è¯ï¼é¿å ä¸å ¶ä»èæ¬å²çª 720 const NAMESPACE = 'phoneViedoThree'; 721 722 // çå¾ DOMå®å ¨å è½½ 723 doc.addEventListener('DOMContentLoaded', function () { 724 // ä¸¥æ ¼éå®å®¹å¨éæ©å¨ 725 const containerSelector = '.phone-viedo-three.swiper-container'; 726 const container = doc.querySelector(containerSelector); 727 if (!container) { 728 console.log(`${NAMESPACE}: 容å¨ä¸åå¨ï¼ä¸åå§å`); 729 return; 730 } 731 732 // æ£æ¥æ¯å¦å·²åå§åï¼é¿å éå¤ 733 if (container[NAMESPACE + 'Initialized']) { 734 console.log(`${NAMESPACE}: å·²åå§åï¼è·³è¿`); 735 return; 736 } 737 738 // çæå¯ä¸ç导èªå ç´ éæ©å¨ 739 const nextBtnSelector = `${containerSelector} .swiper-button-next`; 740 const prevBtnSelector = `${containerSelector} .swiper-button-prev`; 741 742 // åå§åè½®æ 743 const swiperInstance = new Swiper(container, { 744 slidesPerView: 2.3, 745 slideWidth: 2.95 * 100, 746 spaceBetween: 10, 747 autoplay: false, 748 loop: false, 749 freeMode: false, 750 centeredSlides: false, 751 initialSlide: 0, 752 slidesPerGroup: 1, 753 754 resistance: false, 755 resistanceRatio: 0, 756 757 observer: true, 758 observeParents: true, 759 watchSlidesProgress: true, 760 watchSlidesVisibility: true, 761 762 touchRatio: 1, 763 touchAngle: 45, 764 simulateTouch: true, 765 766 // ä¸¥æ ¼éå®å¨å½å容å¨å ç导èªå ç´ 767 navigation: { 768 nextEl: nextBtnSelector, 769 prevEl: prevBtnSelector, 770 }, 771 772 on: { 773 init: function () { 774 this.updateSize(); 775 const slideWidth = 2.95 * 100; 776 777 // æ£æ¥ container æ¯å¦åå¨ä¸æå ç´ 778 if (!this.container || this.container.length === 0) { 779 console.warn(`${NAMESPACE}: 容å¨ä¸åå¨æä¸ºç©ºï¼åå§å失败`); 780 return; 781 } 782 const $container = this.container[0]; 783 if (!$container.offsetWidth) { 784 console.warn(`${NAMESPACE}: 容卿 宽度ï¼å¯è½å°æªæ¸²æï¼ï¼åå§å失败`); 785 return; 786 } 787 788 const containerWidth = this.container[0].offsetWidth; 789 790 this.targetTranslate = -(slideWidth - (containerWidth - (slideWidth * 2 + this.spaceBetween))); 791 792 const firstSlideVisibleRatio = 1 - (Math.abs(this.targetTranslate) / slideWidth);
793 console.log(`${NAMESPACE}: æ»å¨å第ä¸ä¸ªslideå¯è§æ¯ä¾:`, firstSlideVisibleRatio.toFixed(2)); 794 795 // æ 记为已åå§å 796 container[NAMESPACE + 'Initialized'] = true; 797 }, 798 799 slideChangeTransitionEnd: function () { 800 if (this.activeIndex >= 1) { 801 this.setTranslate(this.targetTranslate); 802 } 803 }, 804 805 setTranslate: function (translate) { 806 const minTranslate = Math.min(0, this.targetTranslate); 807 const limitedTranslate = Math.max(translate, minTranslate); 808 this.$el.transform(`translate3d(${limitedTranslate}px, 0, 0)`); 809 } 810 } 811 }); 812 813 // å®å ¨å°æè½½å®ä¾ï¼é¿å è¦ç 814 if (!container[NAMESPACE + 'Instance']) { 815 container[NAMESPACE + 'Instance'] = swiperInstance; 816 } 817 }); 818})(window, document); 819//é¦é¡µè§é¢å¼¹çª 820console.log(window.outerWidth); 821if (window.outerWidth >= 768) { 822 // 页é¢å è½½å®æååå§å 823 window.addEventListener('DOMContentLoaded', () => { 824 // å建å®ä¾ï¼ä½¿ç¨é»è®¤é ç½®ï¼ 825 const videoPlayer = new VideoPopupPlayer({ 826 popupWidth: 320, 827 maxHeight: 400, 828 popupMaxWidth: 500 829 }); 830 }); 831} 832 833 834//////////////////////////////////////////////////////////////////////äºèç½è¿æ³åä¸è¯ä¿¡æ¯ä¸¾æ¥æ»å¾ 835function DenNewsScroll() { 836 var $box = $(".den-news"); 837 var $wrap = $box.find(".news-wrap"); 838 var $items = $wrap.find("a"); 839 var aCount = $items.length; 840 if(aCount <= 1) return; // åªå©1个a å®å ¨éæ¢ ä¸æ»å¨ 841 842 // â æ ¸å¿ä¿®å¤1ï¼å½»åºå é¤éæºæ°ï¼å¼ºå¶åºå®æ¯æ¬¡åªæ»å¨ã1个ãaæ ç¾ï¼æ ¹æ²»è¿ç¿»é®é¢ 843 var singleStep = 1; 844 // åºå®åæ¥é«åº¦ = 容å¨é«åº¦ 0.38rem 尺寸ç»å¯¹å¹é ï¼æ ä»»ä½åå·® 845 var singleHeight = 0.38; 846 var scrollDistance = singleHeight * singleStep + 'rem'; 847 // â æ ¸å¿ä¿®å¤2ï¼åºå®å¨ç»é度 400msï¼ç¨³å®ä¸æ»ï¼æ å¿½å¿«å¿½æ ¢ï¼é¿å è§è§å¡é¡¿ 848 var animateSpeed = 400; 849 850 // â ç»ææ ç¼æ ¸å¿ï¼å å±çåæ»å¨ + ç¬é´è¡¥ä½ï¼ä¸ä¸ä¸ªaç»å¯¹ç´§è´´è·ä¸ï¼æ ä»»ä½çç½/æå± 851 $wrap.stop(true, false).animate({marginTop : "-"+scrollDistance}, animateSpeed, 'linear', function(){ 852 // åªç§»å¨1个æ»åºçaæ ç¾å°æ«å°¾ï¼å¾ªç¯è¡¥ä½ï¼æ çè¡æ¥ 853 $(this).append( $(this).children("a:first") ); 854 $(this).css("marginTop", "0rem"); // remåä½å¤ä½ï¼å°ºå¯¸ç²¾åæ åå·® 855 }); 856} 857 858// â æ ¸å¿ä¿®å¤3ï¼å®æ¶å¨ä¼å + å»¶è¿å¯å¨ 300msï¼è§£å³ã页颿å¼åå§åè¿ç¿»ãçæå鿣 859$(function(){ 860 setTimeout(()=>{ 861 setInterval(DenNewsScroll, 2800); // æ»å¨é´é 2800ms=2.8ç§ï¼å¯ä¿®æ¹ 862 },300); 863});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.