QQMCC 欢迎你的回来。
快捷导航

[大图表格] 大图简约版代码

120 主题
星币
金钱

Rank: 10Rank: 10Rank: 10

发表于 2026-8-26 16:40:55 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转QQMCC。

您需要 登录 才可以下载或查看,没有账号?注册

x

120 主题
星币
金钱

Rank: 10Rank: 10Rank: 10

 楼主| 发表于 2026-8-26 16:48:05 | 显示全部楼层
  1. <div class="dz_attach_masonry_20260906">
  2. <style>
  3. /* ===== 唯一命名空间 dz_attach_masonry_20260906:仅作用于本模块,不污染论坛 ===== */
  4. .dz_attach_masonry_20260906 { max-width: 800px; margin: 12px auto; }
  5. .dz_attach_masonry_20260906 .am-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  6. .dz_attach_masonry_20260906 .am-col { display: flex; flex-direction: column; gap: 12px; }
  7. .dz_attach_masonry_20260906 a { display: block; border-radius: 12px; overflow: hidden; text-decoration: none; }
  8. .dz_attach_masonry_20260906 a:focus,
  9. .dz_attach_masonry_20260906 a:active { outline: none; }
  10. .dz_attach_masonry_20260906 img { width: 100%; height: auto; display: block; border-radius: 8px; }
  11. /* 移动端 */
  12. @media (max-width: 640px) {
  13.   .dz_attach_masonry_20260906 { max-width: 100%; }
  14.   .dz_attach_masonry_20260906 .am-grid { gap: 4px; }
  15.   .dz_attach_masonry_20260906 .am-col { gap: 8px; }
  16. }
  17. </style>

  18. <div class="am-grid">
  19.   <div class="am-col" data-side="left"></div>
  20.   <div class="am-col" data-side="right"></div>
  21. </div>

  22. <script>
  23. (function(){
  24.   // 用 currentScript 锁定"本楼"容器:多个回复框各贴一份时互不干扰
  25.   const root = document.currentScript && document.currentScript.closest
  26.     ? document.currentScript.closest('.dz_attach_masonry_20260906')
  27.     : document.querySelector('.dz_attach_masonry_20260906');
  28.   if(!root) return;
  29.   const colL = root.querySelector('[data-side="left"]');
  30.   const colR = root.querySelector('[data-side="right"]');
  31.   if(!colL || !colR) return;

  32.   // ==========【在这里粘贴全部 <a><img src="xxx"></a> 图片代码】==========
  33.   let imageItemsHtml = `
  34. <!-- 《图片位置》 -->


  35. `;

  36.   const temp = document.createElement('div');
  37.   temp.innerHTML = imageItemsHtml;
  38.   const items = Array.from(temp.children);
  39.   items.forEach(function(item, index){
  40.     if(index % 2 === 0){
  41.       colL.appendChild(item);
  42.     } else {
  43.       colR.appendChild(item);
  44.     }
  45.   });
  46. })();
  47. </script>
  48. </div>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

Archiver|小黑屋|关于我们

Copyright © 2016-2023, Tencent Cloud.    Powered by Discuz! X3.4    鄂ICP备2022014325号-7

GMT+8, 2026-9-12 05:06