Search code examples
javascriptjqueryjquery-pluginscolorbox

Making colorbox pop up on scroll down (inview)


sorry for the basic question, but I have a page I'm trying to build. It's using inview, which triggers Javascript events on reaching a certain div.

The particular event I want to trigger is a colorbox popup opening. I can see how you make the colorbox open on load, but as I'm a bit new to javascript, I've had difficulty making inview trigger it. I've tried searching, but didn't get anywhere.

I've put it on JSBin. Here's the link: http://jsbin.com/idizop/6/edit

Thanks very much in advance! :)


Solution

  • Maybe something like this:

      $('p.inview').bind('inview', function (event, visible) {
        if (visible) 
        { 
          $.colorbox(
            {inline:true, href:"#inline_content"}
          );
        } else {
          $(this).text('nothing');
        }
      });