S
S
Shadowman692018-05-12 01:30:45
JavaScript
Shadowman69, 2018-05-12 01:30:45

Why doesn't the hamburger script work?

There is this script:

$(document).ready(function() {
    function blueasyMenu() {
        var $trigger = $('.hamburger_menu'),
            $menu = $('.menu');

        $trigger.click(function() {
            $menu.slideToggle(); 
        });
    };

    blueasyMenu();
});

For some reason, it does not work, that is, when you click on a hamburger, the menu does not react in any way, as if it does not see it. What could be the reason?
<div class="container header_container">
                <div class="logo_container">
                    <img class="logo" src="images/blueasy_logo.png" alt="Logo"/>
                    <span class="hamburger_menu">&#9776;</span>
                </div>
                <nav>
                    <ul class="menu">
                        <li><a class="active" href="#home">Home</a></li>
                        <li><a href="#services">Services</a></li>
                        <li><a href="#features">Features</a></li>
                        <li><a href="#portfolio">Portfolio</a></li>
                        <li><a href="#contact">Contact</a></li>
                    </ul>
                </nav>
            </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TCloud, 2018-05-12
@Shadowman69

Your function is called once when the document is read. Read what an EventListiner is or just make an on('click') handler

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question