瀏覽大圖時鼠標感應(yīng)控制層滾動條的移動

2010-09-03 23:17:37來源:西部e網(wǎng)作者:


    瀏覽大圖時鼠標感應(yīng)控制層滾動條的移動

< div style="overflow:auto; width:300; height:300" id=a>
  < img src="圖片地址" width="800" height="800" onmousemove='a.scrollLeft=event.x*2.5-a.offsetLeft

  • 瀏覽大圖時鼠標感應(yīng)控制層滾動條的移動

< div style="overflow:auto; width:300; height:300" id=a>
  < img src="圖片地址" width="800" height="800" onmousemove='a.scrollLeft=event.x*2.5-a.offsetLeft-100;a.scrollTop=event.y*2.5-a.offsetTop-100'>
< /div>

  • 用ondrag事件簡單的實現(xiàn)鼠標拖動物件

< script>
//Dhtml:用ondrag事件簡單的實現(xiàn)鼠標拖動物件.
var xx=0,yy=0
< /script>
< img src="圖片地址" style='position:absolute;' ondragstart="setCapture();xx=event.x-this.offsetLeft;yy=event.y-this.offsetTop;" ondrag='this.style.left=event.x-xx;this.style.top=event.y-yy' ondragend="releaseCapture();">

關(guān)鍵詞:滾動條圖片