• kopfundstift

    (@kopfundstift)


    Hi,
    i found this code in another thread but it didnt work for me. I inserted it in the page and also in my Active Scroll Script (which gets defintly loaded on the page). But nothing happens. I use the q2w3 fixed widget.

    but on mobile the toc is not collapsed.

    used this code:

    
    <script>
    (function() {
        if (window.innerWidth <= 768) {
            var handle = function() {
                var els = document.getElementsByClassName('lwptoc_toggle_label');
                for (var i = 0, l = els.length; i < l; ++i) {
                    els[i].click();
                }
            };
            if (document.readyState === 'loading') {
                document.addEventListener('DOMContentLoaded', handle);
            } else {
                handle();
            }
        }
    })();
    </script>

    this is a page:
    https://kopfundstift.de/wordpress-portfolio-themes
    (but i deactivated the toc now because its a live page)
    great plugin by the way!

  • The topic ‘Collapse on mobile’ is closed to new replies.