Trying to do one thing on the site. Flexslider slider connected, initialized as follows:

$(window).load(function(){ $('.textslider').flexslider({ animation: "fade", slideshow: false }); }); 

I would like to see .flex-direction-nav a page scroll up when clicking on the slider navigation .flex-direction-nav a element. I use such jquery:

 $(".flex-direction-nav a").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); 

Che does not work like that. Maybe you need to put one script in another, or something else. scrollTop has already used a lot of scrollTop , but it's still there. Help who than can

    1 answer 1

    Not click, but on ('click' ... Therefore, click does not work on dynamically created elements (not existing at the time of the click event)).

     $('.flex-direction-nav a').on('click', function() { $('body,html').animate({ scrollTop: 0 }, 'slow'); return false; }); 
    • It doesn't work either ( - Leo
    • And what about the console? - KAGG Design
    • Nothing. There are no mistakes - Leo
    • I looked at the working code for myself - there is body, html. I do not remember why. Corrected the answer. - KAGG Design
    • And if you put a breakpoint inside the function? Does she at least react to a click? - KAGG Design