2012-02-04 48 views

回答

1

使用HTML5畫布可以滾動這樣的:

JS:

var img = new Image(); 
img.src = 'image.jpg'; 

var w = $(window).outerWidth(); 
var h = $(window).height(); 

var addit = -1; 
var scrollSpeed = 10; 
var current = 0; 

ctx = document.getElementById('canvas1').getContext('2d'); 

var init = setInterval(function() { 
       current += addit; 
       ctx.drawImage(img,current,0, w, h); 
      }, scrollSpeed); 

CSS:

body { 
    overflow: hidden; 
} 
#canvas1 { 
    position: absolute; 
    height: 100%; 
    width: auto; 
    left: 0; 
    top: 0; 
} 

HTML:

<canvas id="canvas1" width="1784px" height="534px"></canvas>