mercredi 29 juin 2016

How to implement JS from HTML to WordPress?

Recently, I'm really interested in building WordPress template. I started doing it, but I am really stuck now. The thing is, i have HTML file of my frontpage (index.html), and the CSS and JS all in their folders. Now, I can't seem to find a way to make the JS work on WordPress platofrm, like its working on HTML.

I only want to make that menu work, don't mind the other bugs.

http://brainstorm.comoj.com/ -- HTML

http://bsarafimov21.byethost16.com/ -- WordPress

Here is the code i want to transfer from HTML to WordPress:

<script type="text/javascript">
    $(document).ready(function () {
        var trigger = $('.hamburger')
            , overlay = $('.overlay')
            , isClosed = false;

        trigger.click(function () {
            hamburger_cross();
        });

        function hamburger_cross() {

            if (isClosed == true) {
                overlay.hide();
                trigger.removeClass('is-open');
                trigger.addClass('is-closed');
                isClosed = false;
            } else {
                overlay.show();
                trigger.removeClass('is-closed');
                trigger.addClass('is-open');
                isClosed = true;
            }
        }

        $('[data-toggle="offcanvas"]').click(function () {
            $('#wrapper').toggleClass('toggled');
        });
    });
</script>

Aucun commentaire:

Enregistrer un commentaire