Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2249

phpBB Custom Coding • Re: Set additonal class on .page-jump if current page = 1

$
0
0
I was just looking at this again, purely out of curiosity, and I think the only sane way of doing it would be with javascript.

Adding a class or ID to the current page li when current page = 1 is easy. That's just <li class="active"{% if pagination.PAGE_NUMBER == 1 %} id="woof"{% endif %}> but the catch is that you can't use that to target the .page-jump with CSS, because CSS only targets things down the markup and flatly refuses to swim upstream.

But, you can nail the sod with javascript easily enough:

Code:

<script>const activePages = document.querySelectorAll('div.pagination > ul > li.active:nth-child(2)');for (const activePage of activePages) {activePage.previousElementSibling.classList.add('woof')}</script>
At the moment I can't see an easier way of doing it. I'm calling this solved for now.

Statistics: Posted by Gumboots — Sun Apr 13, 2025 1:27 am



Viewing all articles
Browse latest Browse all 2249

Trending Articles