C
C
Conover2015-10-28 20:06:11
css
Conover, 2015-10-28 20:06:11

How to make this code work?

Here is the codepen.io/anon/pen/PPegLx project itself and its code, but with top: -100% the button is not pressed and that same slide-out menu is not obtained, and if top: -100% is removed, then the side menu is below, but it works .How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2015-10-29
@Conover

You have the code responsible for the click event - here it is:

$('[data-toggle]').click(function () {
        var toggle_el = $(this).data('toggle');
        $(toggle_el).toggleClass('open-sidebar');
    });

For all elements containing the data-toggle attribute, it adds a click event handler that looks for the element identified by the selector specified in the attribute value. And then a class is added or removed to this object. In order for everything to work for you, you need to add the data-toggle attribute with the value .container to the html code .
Like this:
<div class='description' data-toggle='.container'>
</div>

In general, it is not very clear why you need such a complex system for determining the element that needs to be collapsed / expanded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question