账号通
    

账号  

密码  

7078

查看

12

回复
主题:[分享]为KesionCMS V8系列文章内容页添加HighSlide Js图片特效 [收藏主题] 转到:  
悠客 当前离线

213

主题

15

广播

7

粉丝
添加关注
级别:二年级

用户积分:996 分
登录次数:401 次
注册时间:2010/11/8
最后登录:2019/10/28
悠客 发表于:2012/3/31 15:49:00   | 只看该作者 查看该作者主题 楼主 
科汛在线网校系统

其实HighSlide Js图片特效已经比较古老了,感兴趣的朋友可以百度下相关知识。本文仅针对文章系统内容页实现此功能。



下面是实现方法:



一、修改文章系统内容页模板

请自行对照修改红色部分代码

  1. <link href="{$GetInstallDir}images/style.css" type=text/css rel=stylesheet>
  2. <link href="{$GetInstallDir}ks_inc/highslide/highslide.css" type=text/css rel=stylesheet>
  3. <style type="text/css">
  4. .innerlink{color:#FF6600;font-weight:bolder;text-decoration:none}
  5. </style>
  6. <script src="{$GetInstallDir}ks_inc/jquery.js" type="text/javascript"></script>
  7. <script src="{$GetInstallDir}ks_inc/common.js" type="text/javascript"></script>
  8. <script src="{$GetInstallDir}ks_inc/highslide/highslide.js" type="text/javascript"></script>
  9. <script type="text/javascript">
  10. hs.graphicsDir = '/ks_inc/highslide/graphics/';
  11. hs.align = 'center';
  12. hs.transitions = ['expand', 'crossfade'];
  13. hs.wrapperClassName = 'dark borderless floating-caption';
  14. hs.fadeInOut = true;
  15. hs.dimmingOpacity = 1;   //数字1为全黑背景
  16. // Add the controlbar
  17. if (hs.addSlideshow) hs.addSlideshow({
  18. //slideshowGroup: 'group1',
  19. interval: 5000,
  20. repeat: false,
  21. useControls: true,
  22. fixedControls: 'fit',
  23. overlayOptions: {
  24. opacity: .6,
  25. position: 'bottom center',
  26. hideOnMouseOut: true
  27. }
  28. });
  29. </script>
  30. <SCRIPT language=JavaScript type=text/JavaScript>
  31. <!--
  32. //图片等比例缩放
  33. var FitWidth = 400; //图片宽度
  34. var FitHeight = 300; //图片高度
  35. function ResizePic(ImgTag)
  36. {
  37. var image = new Image();
  38. image.src = ImgTag.src;
  39. if(image.width>0 && image.height>0){
  40. if(image.width/image.height >= FitWidth/FitHeight){
  41. if(image.width > FitWidth){
  42. ImgTag.width = FitWidth;
  43. ImgTag.height = (image.height*FitWidth)/image.width;
  44. }
  45. else{
  46. ImgTag.width = image.width;
  47. ImgTag.height = image.height;
  48. }
  49. }
  50. else{
  51. if(image.height > FitHeight){
  52. ImgTag.height = FitHeight;
  53. ImgTag.width = (image.width*FitHeight)/image.height;
  54. }
  55. else{
  56. ImgTag.width = image.width;
  57. ImgTag.height = image.height;
  58. }
  59. }
  60. }
  61. }
  62. //-->
  63. </SCRIPT>

说明:在这里请将原来自带的图片缩放代码去掉。



二、打开Ks_Cls/Kesion.Label.CommonCls.asp,在文件最后找到Function FormatImglink(content,url,totalpage)这段函数,全部改为

  1. Function FormatImglink(content,url,totalpage)
  2.           dim re:Set re=new RegExp
  3.            re.IgnoreCase =true
  4.            re.Global=True
  5.      '去除onclick,onload等脚本
  6.             're.Pattern = "\s[on].+?=([\""|\'])(.*?)\1"
  7.             'Content = re.Replace(Content, "")
  8.    Dim LinkStr
  9.       'If TotalPage=1 Then
  10.     LinkStr="class=""highslide"" onclick=""return hs.expand(this)"" href=""$2"" target=""_blank"""
  11.    'Else
  12.     'LinkStr="href=""" & Url & """"
  13.    'End If
  14.    
  15.      '将SRC不带引号的图片地址加上引号
  16.             re.Pattern = "<img.*?\ssrc=([^\""\'\s][^\""\'\s>]*).*?>"
  17.             Content = re.Replace(Content, "<a " & LinkStr & "><img src=""$2"" alt=""" & GetNodeText("title") & """ onload=""javascript:ResizePic(this)"" border=""0""/></a>")
  18.      '正则匹配图片SRC地址
  19.      re.Pattern = "<img.*?\ssrc=([\""\'])([^\""\']+?)\1.*?>"
  20.            Content = re.Replace(Content, "<a " & LinkStr & "><img src=""$2"" alt=""" & GetNodeText("title") & """ onload=""javascript:ResizePic(this)"" border=""0""/></a>")

  21.     set re = nothing

  22.           FormatImglink = content
  23.   end function

三、下载文件包到Ks_Inc目录下(直接覆盖原来的highslide文件夹)

 下载信息  [文件大小:40.61 KB 下载次数: 次]
点击下载文件:highslide.rar

进入后台重新生成内容页面。完工!

 
科讯NET交流群 321062970
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
jyqida 当前离线

179

主题

0

广播

0

粉丝
添加关注
级别:一年级

用户积分:308 分
登录次数:81 次
注册时间:2012/2/23
最后登录:2012/8/10
jyqida 发表于:2012/3/31 16:14:00   | 只看该作者 查看该作者主题 沙发 
谢谢指点了,留着以后有用的着的地方了
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
ailuweisi3 当前离线

122

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:129 分
登录次数:5 次
注册时间:2012/3/20
最后登录:2012/4/2
ailuweisi3 发表于:2012/4/2 8:17:00   | 只看该作者 查看该作者主题 藤椅 
精品不能错过
感谢楼主分享!
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
最新程序 当前离线

83

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:79 分
登录次数:6 次
注册时间:2010/11/17
最后登录:2012/4/12
最新程序 发表于:2012/4/2 16:21:00   | 只看该作者 查看该作者主题 板凳 
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
zxl01234566 当前离线

97

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:79 分
登录次数:4 次
注册时间:2012/4/1
最后登录:2012/4/19
zxl01234566 发表于:2012/4/2 16:56:00   | 只看该作者 查看该作者主题 报纸 
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
d121121 当前离线

277

主题

5

广播

1

粉丝
添加关注
级别:二年级

用户积分:1500 分
登录次数:277 次
注册时间:2011/5/6
最后登录:2021/12/3
d121121 发表于:2012/4/3 20:06:00   | 只看该作者 查看该作者主题 地板 
科汛在线商城系统(NET)

好是好,但如果是有分页,就无法显示了!

 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
hejian 当前离线

1201

主题

4

广播

4

粉丝
添加关注
级别:九年级

用户积分:3522 分
登录次数:563 次
注册时间:2006/12/26
最后登录:2024/1/21
hejian 发表于:2012/4/4 4:02:00   | 只看该作者 查看该作者主题 7楼 
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
悠客 当前离线

213

主题

15

广播

7

粉丝
添加关注
级别:二年级

用户积分:996 分
登录次数:401 次
注册时间:2010/11/8
最后登录:2019/10/28
悠客 发表于:2012/5/7 14:45:00   | 只看该作者 查看该作者主题 8楼 
做在线知识付费 选科汛云开店
以下是引用 d121121在2012-4-3 20:06:00的发言:

好是好,但如果是有分页,就无法显示了!

原帖已修正!

 
科讯NET交流群 321062970
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
t573632136 当前离线

44

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:58 分
登录次数:4 次
注册时间:2012/4/18
最后登录:2012/8/9
t573632136 发表于:2012/5/7 14:50:00   | 只看该作者 查看该作者主题 9楼 
 
盐田送水公司,沙头角送水电话,深圳送水www.songshui365.com
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
pcik 当前离线

182

主题

3

广播

0

粉丝
添加关注
级别:一年级

用户积分:1793 分
登录次数:99 次
注册时间:2010/11/14
最后登录:2015/4/7
pcik 发表于:2012/5/7 15:20:00   | 只看该作者 查看该作者主题 10楼 
科汛智能建站系统
项一下,不能沉了,值的收藏
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
<上一主题 | 下一主题 >
Powered By KesionCMS Version X1
厦门科汛软件有限公司 © 2006-2016 页面执行0.26563秒 powered by KesionCMS 9.0