怎么是你

关注互联网,关注搜索,关注信息技术对现代生活方方面面的影响

« CSS非链接手形的设置继续中毒——准备购入WASP V3了 »

动易中限制图片显示大小及鼠标滚动缩放图片大小的修改方法

        动易Siteweaver的模板系统默认情况下会自动添加一些JS,从而达到限制图片大小及鼠标滚动缩放图片的目的,但有的时候这种机制会失效。当我们自己添加相应JS时却发现不启作用,所以必须先关闭动易的这种自动添加功能。

        这些由动易自动强制产生的代码如下:

<!--
//改变图片大小
function resizepic(thispic)
{
  return true;
}
//无级缩放图片大小
function bbimg(o)
{
  return true;
}
-->

        若要去除这些代码,方法如下:  

找到管理模板的页面 Admin/Admin_Template.asp

在Admin/Admin_Template.asp 页面中找到 Function ShiftCharacterSave(Content) ,然后在此函数中找到

'解决正文页用户删除图片js 问题
    strPhotoJs = "<script language=""JavaScript"">" & vbCrLf
    strPhotoJs = strPhotoJs & "<!--" & vbCrLf
    strPhotoJs = strPhotoJs & "//改变图片大小" & vbCrLf
    strPhotoJs = strPhotoJs & "function resizepic(thispic)" & vbCrLf
    strPhotoJs = strPhotoJs & "{" & vbCrLf
    'strPhotoJs = strPhotoJs & "if(thispic.width>700) thispic.width=700;" & vbCrLf
    strPhotoJs = strPhotoJs & "  return true;" & vbCrLf
    strPhotoJs = strPhotoJs & "}" & vbCrLf
    strPhotoJs = strPhotoJs & "//无级缩放图片大小" & vbCrLf
    strPhotoJs = strPhotoJs & "function bbimg(o)" & vbCrLf
    strPhotoJs = strPhotoJs & "{" & vbCrLf
    'strPhotoJs = strPhotoJs & "  var zoom=parseInt(o.style.zoom, 10)||100;" & vbCrLf
    'strPhotoJs = strPhotoJs & "  zoom+=event.wheelDelta/12;" & vbCrLf
    'strPhotoJs = strPhotoJs & "  if (zoom>0) o.style.zoom=zoom+'%';" & vbCrLf
    strPhotoJs = strPhotoJs & "  return true;" & vbCrLf
    strPhotoJs = strPhotoJs & "}" & vbCrLf
    strPhotoJs = strPhotoJs & "-->" & vbCrLf
    strPhotoJs = strPhotoJs & "</script>" & vbCrLf
    strPhotoJs = strPhotoJs & "</head>" & vbCrLf

上面的每一句话其实就对应产生了自动添加的一行代码,我们只要把不需要的行注释掉就行了。注意:最后一句应该要保留

如果你需要自己实现限制图片大小效果则可以这样做:

建立一个JS文件,内容为:

<!--
//改变图片大小
function resizepic(thispic)
{
if(thispic.width>700) thispic.width=700;
}
//无级缩放图片大小
function bbimg(o)
{
  var zoom=parseInt(o.style.zoom, 10)||100;
  zoom+=event.wheelDelta/12;
  if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}
-->

然后在模板中调用这个文件(具体路径根据情况而定):

<script src="{$InstallDir}skin/ltezwai/Css/js.js" type="text/javascript"></script>

        这样就可以实现控制的效果了。

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站分类

最近发表

最新评论及回复

文章归档

Search

Powered By Z-Blog 1.8 Spirit Build 80722 Designed by Han'space

桂ICP备06007671号Copyright building. Some Rights Reserved.