当前位置:资源吧源码资讯中心论坛文章动网论坛 → 文章内容

动网7.0sp2 如何去掉鼠标滚轮缩放图片和鼠标滚轮缩放签名图片

减小字体 增大字体 作者:未知  来源:http://www.ziyuan8.com/down  发布时间:2004-9-25 18:58:07

修改inc\main.js文件,在第201行左右,找到

function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}

改为

function bbimg(o){
// var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
// return false;}

就好了。其实就是做了一下注释,让这两行代码不执行罢了。要想重新开启这个功能,只要去掉那几个//就可以了。

以上方法用于完全去掉图片滚轮缩放(包括签名和帖子图片),要想分别进行设置,请修改:inc\Dv_ubbcode.asp (注意!上面的方法和下面将要提到的方法不能同时使用,是完全不同的两个修改方法!)

找到:

Private Function bbimg(strText,ssize)
  Dim s
  s=strText
  re.Pattern="<img(.[^>]*)>"
  If ssize=500 Then
   s=re.replace(s,"<img$1onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";"">")
  Else
   s=re.replace(s,"<img$1onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";if(this.height>100)this.height=100;"">")
  End If
  bbimg=s
End Function

注意红色底色的这几行代码!其中,第一段(if ... then下面的代码,黑色字)是用于帖子里的图片的,第二段(Else下面的代码,绿色字)是用于签名的图片的,黄色底色的onmousewheel=""return bbimg(this)"" 用于检测鼠标滚轮事件,想去掉鼠标滚轮功能,就删掉这段代码。举例说明:

以下代码去掉了签名中的鼠标滚轮操作:(注意比较!)

If ssize=500 Then
   s=re.replace(s,"<img$1onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";"">")
  Else
   s=re.replace(s,"<img$1onload=""javascript:if(this.width>screen.width-"&ssize&")this.width=screen.width-"&ssize&";if(this.height>100)this.height=100;"">")
  End If