WordPress.org

Ready to get started?Download WordPress

Forums

Code does not work when save offline or applied to other site (5 posts)

  1. vkhu
    Member
    Posted 5 months ago #

    Hi guys. Just recently, I ran across this amazing piece of work: http://codepen.io/yesimaaron/pen/CFpeL

    I tried to save the page for offline studying. However, when I reopen the offline html file, the menu button doesn't work.

    Specifically, everything load like normal, but I can keep clicking the menu button on the top right corner till kingdom come and nothing will happen. If the menu is already open when I save it, it will stay open. If it's not, nothing can get it to load.

    I tried to copy the code to my site, and the same thing happened. No matter how many time I click the button, nothing will come down.

    Can anyone explain this, please?

  2. Jose Castaneda
    Member
    Posted 5 months ago #

    How are you enqueuing the JS files?

  3. vkhu
    Member
    Posted 5 months ago #

    I just put all the JS in a <script> tag inside the header.php. Is that wrong? I'm quite new to this whole coding thing.

  4. Jose Castaneda
    Member
    Posted 5 months ago #

    Sort of wrong.

    Better question: how are you loading jQuery?

    Is this a custom theme you are using, pre-made, where did you get it from?

    Sorry, for so many questions but the more information you give the better we can understand what is happening. :)

  5. vkhu
    Member
    Posted 5 months ago #

    I create a function.php file and add the following code:

    add_action( 'wp_enqueue_script', 'load_jquery' );
    function load_jquery() {
        wp_enqueue_script( 'jquery' );
    }

    As for the theme, I'm creating a child theme of the theme customizr.

Reply

You must log in to post.

About this Topic