Simple jQuery callbacks break in IE

I have several such functions:

$(this).find('.subnav').fadeIn(200, buttonHide );

Now, buttonHide, in this case, is a function that I declared elsewhere. Once the 200 second fadeIn is complete, I want to call this function.

Great. Works in FF and Safari. However, in IE, it returns an error as undefined. Actually, I experienced a SAME problem using the onAfter function in Ariel FleslerTo scroll ... what gives?

What do I need to do for IE to be able to trigger these callbacks?

EDIT: here is the code that includes the function. This page is called AFTER the fragment above ... I'm a little noob; This is problem? Nothing starts until AFTER everything is loaded.

jQuery(function( $ ){

    /* BEGIN MENU SCROLLER INITIALIZATION */

        // Resets pane
    $('.menuClip').scrollTo( 0 );

    // scrolls to active item to 
    $('body:not(.archive) .menuClip').stop().scrollTo( $('.current_page_item') );

    $('.menuDown').click(function(){
        $('.menuClip').stop().scrollTo( '+=70px', 800, {
            onAfter:function(){
                buttonHide();
            },
        });
    });
    $('.menuUp').click(function(){
        $('.menuClip').stop().scrollTo( '-=70px', 800, {
            onAfter:function(){
                buttonHide();
            },
        });
    });

/* END MENU SCROLLER INITIALIZATION */  

});

$(buttonHide = function() {
    setTimeout(function(){
        var elemM = $(document).find('.menuClip:visible');
        if (elemM[0].scrollHeight - elemM.scrollTop() == elemM.outerHeight()) {
            $('.menuDown').animate({"opacity":"0"}, 200);
        } else {
            $('.menuDown').animate({"opacity":"1"}, 200);
        }

        if (elemM.scrollTop() == 0) {
            $('.menuUp').animate({"opacity":"0"}, 200);
        } else {
            $('.menuUp').animate({"opacity":"1"}, 200);
        }
    }, 200);
});
+3
1

, : IE:

$('#move_this_up').click(function(){
    $('#content').stop().scrollTo( '-=270', 1000,
        { onAfter:function(){
            inactiveContentStates();
        }, // COMMA BAD!!!!
    });
});

.

, !

+4

Source: https://habr.com/ru/post/1735114/


All Articles