How to create popup on scroll to section (i have demo)

I try to create a popup with the condition if you scroll to a section to open a popup. I found a code with an alert message, about how I can open my modal

$(window).on(‘scroll’,function() {
if (checkVisible($(’#tester’))) {
alert(“Visible!!!”);
$(window).off(‘scroll’);
} else {
// do nothing
}
});

function checkVisible( elm, eval ) {
eval = eval || “object visible”;
var viewportHeight = $(window).height(), // Viewport Height
scrolltop = $(window).scrollTop(), // Scroll Top
y = $(elm).offset().top,
elementHeight = $(elm).height();

if (eval == "object visible") return ((y < (viewportHeight + scrolltop)) && (y > (scrolltop - elementHeight)));
if (eval == "above") return ((y < (viewportHeight + scrolltop)));

}