• Hi there

    First of all: great plugin, thank you!

    Is it possible to hide the content by default for mobile visitors only? So desktop visitors see the table of contents, but for mobile it is hidden by default.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author LuckyWP

    (@theluckywp)

    Hello!

    Unfortunately, plugin don’t support this possibility.

    But you can try make JS, which hide TOC by window width. For example, so:

    (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();
            }
        }
    })();
    Thread Starter petrr1

    (@petrr1)

    Thank you for replying. Any idea where to put this js? I have no idea.
    Thanks in advance.

    Plugin Author LuckyWP

    (@theluckywp)

    You can to JS file in your theme. Or use us plugin LuckyWP Scripts Control, but code need wrap to tag <script>:

    <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>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Possible to hide content on mobile?’ is closed to new replies.