V
V
Valeriy19972015-09-10 09:38:58
JavaScript
Valeriy1997, 2015-09-10 09:38:58

Why doesn't the block exit work when the button is pressed?

There is a class On_seorch_interface, when you click on it leaves . And when you click on with the getstyle class, it leaves.

Normally, this only works once. Further, the script "lives its own life". Where is the mistake?

$(document).ready(function() {
    var timeout_id;
    var tgl = 1
    $(".getstyle").click(function() {
        if (tgl !== 1) {
            timeout_id = window.setTimeout(function() {
                $(".serch_fild_block").animate({
                    height: 'hide'
                }, 800, 'easeInCirc')
            }, 100);
            $(".form-controls").animate({
                marginLeft: '2500px'
            }, 900, 'easeInCirc')
        }
    });

    $(".On_seorch_interface").click(function() {
        if (tgl === 1) {

            $(".serch_fild_block").animate({
                height: 'show'
            }, 800, 'easeInCirc');
            timeout_id = window.setTimeout(function() {
                $(".form-controls").animate({
                    marginLeft: '500px'
                }, 1000, 'easeOutQuart')
            }, 800);
            tgl = 0
        } else {
            tgl = 1
        }
    });
});


Here is the whole code: jsfiddle.net/t52ka/115

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Oleg Matrozov, 2015-09-10
@Valeriy1997

I would start by looking in the debugger and seeing an error about an unknown easing function. Remove from the parameters to animate ", 'easeOutQuart'" and the code will start working. True, this does not cancel the general curvature of the code.

A
Alexander Stepanov, 2015-09-10
@zloycoder

The author, can you find out the original task, which was?

D
Dmitry Pavlov, 2015-09-10
@dmitry_pavlov

When I click in jsFiddle in the developer console (F12), I see
an Uncaught TypeError: jQuery.easing[this.easing] is not a function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question