Dojo window Scroll example

by Silambarasan_sundaram

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/resources/dojo.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css">
<div style="height:1600px;border:1px solid;">
test
</div>

JavaScript

dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");


dojo.ready(function() {
    
dojo.connect(
    window, "onscroll", tryIt                                                                                                                                  );
    
});

    function tryIt() {
//Browsers Content area
var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
        
        //scroll position
var pageoffset = window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
        
var newPagePosition = pageoffset;
        
//let’s call the next page after the page is scrolled 1/4<sup>th</sup> of total content area and be sure it is moved downwards
if((windowHeight/0.5)<= newPagePosition){

    alert(newPagePosition)
}

    }