HTML and CSS Reference
In-Depth Information
Fine Scrolling Full Code Example
Example 9-3 shows the full code listing for the Fine Scrolling example. Notice that this code
adds in the colBuffer and rowBuffer variables as well as the matrix transformation secret
that performs the actual smooth fine scrolling.
Example 9-3. Fine scrolling
<!doctype html>
<html
<html lang= "en" >
<head>
<head>
<meta
<meta charset= "UTF-8" >
<title>
<title> CH9 EX4 Scrolling Test 2 fine scrolling </title>
</title>
< script src = "modernizr.js" >< /script>
< script type = "text/javascript" >
window . addEventListener ( 'load' , eventWindowLoaded , false
false );
function
function eventWindowLoaded () {
canvasApp ();
}
< /script>
< script language = "Javascript" >
function
function canvasSupport () {
return
return Modernizr . canvas ;
}
function
function canvasApp (){
iif ( ! canvasSupport ()) {
return
return ;
} else
else {
var
var theCanvas = document . getElementById ( 'canvas' );
var
var context = theCanvas . getContext ( '2d' );
}
document . onkeydown = function
function ( e ){
e = e ? e : window . event ;
keyPressList [ e . keyCode ] = true
true ;
Search WWH ::




Custom Search