首页广场:「全部」里翻卡时右上角分类滑块跟着当前卡的归属类跳
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,11 @@
|
||||
c.tabIndex = d === 0 ? 0 : -1;
|
||||
});
|
||||
pgB.textContent = idx + 1; pgI.textContent = '/' + cards.length;
|
||||
/* 11-02 用户:滑到哪张图,右上角分类小滑块跟着跳到它的归属类(只在「全部」里跳;投稿卡回到「全部」;选了具体分类时不动) */
|
||||
if (cur === '') {
|
||||
var cc = cards[idx] && (cards[idx].className.match(/\bc-(\w+)/) || [])[1] || '';
|
||||
[].forEach.call(sec.querySelectorAll('.g4-cat button'), function (x) { x.classList.toggle('on', x.dataset.cat === cc); });
|
||||
}
|
||||
sec.querySelector('.g4-arr.prev').disabled = idx === 0;
|
||||
}
|
||||
function next() {
|
||||
@@ -160,7 +165,7 @@
|
||||
sec.querySelector('.g4-all').addEventListener('click', function () { go(''); });
|
||||
sec.querySelector('.g4-cat').addEventListener('click', function (e) {
|
||||
var b = e.target.closest('button[data-cat]');
|
||||
if (!b || b.classList.contains('on')) return;
|
||||
if (!b || b.dataset.cat === cur) return; // 「全部」里滑块跟着卡片跳,所以按当前筛选判断,不按高亮判断
|
||||
[].forEach.call(sec.querySelectorAll('.g4-cat button'), function (x) { x.classList.toggle('on', x === b); });
|
||||
paint(b.dataset.cat);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user