利用IE5.5以上版本的新的CSS屬性,用JS判斷如果圖像的尺寸大於一個定值時,用ZOOM縮放
建個名為zoom.htc的behavior文件,代碼如下:
<public:attach event="oncontentready"" onevent="zoom()" />
<script language="javascript">
function zoom(){
if(this.width>760)this.style.zoom=1/(width/760); //ZOOM=1除以(寬除以規定寬度的)
}
</script>
具體應用該behavior
在網頁中加入以下代碼:
<style>
.hyperlook img { behavior:url('zoom.htc')} //注意ZOOM.htc的路徑
</style>
最後在需要控制的地方的前後加入:<div class="hyperlook"> </div>
以上只是在ie中的解決方法