fix(nav): stop click ripple from stretching CTA chips
.aksrt-wave was injected into .but without position:absolute, so the oversized span expanded header publish/VIP buttons on click. Make the wave absolute, honor .nowave, and skip navbar CTA roots.
This commit is contained in:
1 parent
77150afe38
commit
d3cae1f1cb
3 files changed
+63
-4
No files matched your search
@@ -796,6 +796,10 @@
|
||||
document.addEventListener('click', function (e) {
|
||||
var target = e.target.closest(RIPPLE_SELECTORS);
|
||||
if (!target) return;
|
||||
// Markup opt-out (header publish uses class="nowave") + nav CTA chips
|
||||
if (target.classList.contains('nowave') || target.closest('.nowave')) return;
|
||||
if (target.classList.contains('navbar-cta') || target.closest('.navbar-cta')) return;
|
||||
if (target.closest('.navbar-top .navbar-but, .navbar-top .navbar-vip, .navbar-but-cluster')) return;
|
||||
if (target.querySelector('.aksrt-wave')) return;
|
||||
|
||||
var rect = target.getBoundingClientRect();
|
||||
@@ -805,13 +809,18 @@
|
||||
|
||||
var wave = document.createElement('span');
|
||||
wave.className = 'aksrt-wave';
|
||||
wave.style.cssText = 'width:' + size + 'px;height:' + size + 'px;left:' + x + 'px;top:' + y + 'px;';
|
||||
// Must be absolute — without it the huge span expands the button box ("变长").
|
||||
wave.style.cssText = 'position:absolute;pointer-events:none;border-radius:50%;background:rgba(255,255,255,0.35);width:'
|
||||
+ size + 'px;height:' + size + 'px;left:' + x + 'px;top:' + y + 'px;transform:scale(0);animation:aksrtWaveRipple .6s ease-out forwards;';
|
||||
|
||||
var pos = getComputedStyle(target).position;
|
||||
if (pos === 'static') target.style.position = 'relative';
|
||||
var cs = getComputedStyle(target);
|
||||
if (cs.position === 'static') target.style.position = 'relative';
|
||||
if (cs.overflow === 'visible') target.style.overflow = 'hidden';
|
||||
|
||||
target.appendChild(wave);
|
||||
setTimeout(function () { wave.remove(); }, 600);
|
||||
setTimeout(function () {
|
||||
if (wave.parentNode) wave.parentNode.removeChild(wave);
|
||||
}, 600);
|
||||
});
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in new issue
Block a user