PageSourceSearch

https://www.sznews.com/2025/js/2025-index.js

js sznews.com collected 2026-09-24 09:17:54 UTC 29,087 bytes, 863 lines download raw bytes

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.