Scroll down to next div in jquery

Cannot scroll down while working in my jquery script:

jQuery('.overlay_'+onderzoekid).css("background", "green"); 
jQuery('.check_'+onderzoekid).each(function() 
{
    this.checked = true;  
});

If this is checked, trueskip to the next overlay div.

+4
source share
1 answer

You can check if your element is checked with jquery is(':checked'), and if true, go to the associated overlay with that element with scrollTop:

jQuery('.check_'+onderzoekid).each(function() 
{
    if ( $(this).is(':checked') )
    {
        $('html, body').animate({
            'scrollTop' : jQuery('.overlay_'+onderzoekid).position().top
        });
    }
});

Hope this helps.

+1
source

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


All Articles