tags:

views:

83

answers:

0

I've found some ideas, such as http://www.dustindiaz.com/element-scroll-into-view/, but I need a Mozilla/Chrome compatible solution that's not using any frameworks (YUI, jQuery, Prototype, etc.)

In short I need to convert this YUI code to non-YUI code:

var Event = YAHOO.util.Event;
var Dom = YAHOO.util.Dom;
Event.on(window, 'load', function() {
    var y = Dom.getY('ft');
    Event.on(window, 'scroll', function() {
        var top = (document.documentElement.scrollTop ?
            document.documentElement.scrollTop :
            document.body.scrollTop);
        var vpH = Dom.getViewportHeight();
        var coverage = parseInt(vpH + top);
        if ( coverage >= y ) {
            console.log('in view!!!');
        }
    });
});

(Javascript is not my forte, but in this particular situation I can't use a framework)