Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] DZ!X2.0首页轮幻缩略图,焦点图,幻灯片,JS+css源码及安装使用教程

[复制链接]
tkggnmnn 发表于 2011-6-23 19:10:14 | 显示全部楼层 |阅读模式
插件发布
插件名称: 定西在线原则轮幻缩略图
插件来源: 二次修改他人插件
适用版本: Discuz! X2
语言编码: GBK简体 
最后更新时间: 2011-06-23
插件作者: 恺子
插件简介: DZ!X2.0首页轮幻缩略图,焦点图,幻灯片,JS+css源码及安装使用教程
本帖最后由 tkggnmnn 于 2011-6-23 19:12 编辑

1.将下载的FLV文件夹上传到论坛使用的模板的根目录;
2.将在后台新建一个模块模板。命名为“门户首页百变幻灯片”;复制下列代码

  1. <div id="focus_change">
  2. <div id="focus_change_list" style="top:0; left:0;">
  3.   <ul>
  4. [loop]
  5. <li>
  6. <div class="img_item">
  7.         <div><a href="{url}" target="_blank"><img src="{pic}"></a></div>
  8.         <div class="desc">
  9.                 <h5><a href="1.jpg" target="_blank">{title}</a></h5>
  10.         </div>
  11. </div>
  12. </li>
  13. [/loop]
  14. </ul>
  15. </div>
  16. <div class="focus_change_opacity"></div>
  17. <div class="focus_change_opacity1"></div>
  18. <div id="focus_change_btn">
  19.   <ul>
  20.                 [loop]<li><a href="{url}"><img src="{pic}" /></a></li>[/loop]
  21.   </ul>
  22. </div>
  23. </div>
复制代码




3.模块管理-数据调用-增加数据调用-模块分类(帖子模块)-模块标识 (门户首页百变幻灯片)-显示样式(门户首页百变幻灯片)

4.内部调用 将这样<!--{block/677}-->像似的代码放到你的首页幻灯片位置


5.并将以下代码放到<head>.....</head>之间;
  1. <script type="text/javascript">
  2. function $(id) { return document.getElementById(id); }
  3. function moveElement(elementID,final_x,final_y,interval) {
  4.   if (!document.getElementById) return false;
  5.   if (!document.getElementById(elementID)) return false;
  6.   var elem = document.getElementById(elementID);
  7.   if (elem.movement) {
  8.     clearTimeout(elem.movement);
  9.   }
  10.   if (!elem.style.left) {
  11.     elem.style.left = "0px";
  12.   }
  13.   if (!elem.style.top) {
  14.     elem.style.top = "0px";
  15.   }
  16.   var xpos = parseInt(elem.style.left);
  17.   var ypos = parseInt(elem.style.top);
  18.   if (xpos == final_x && ypos == final_y) {
  19.   return true;
  20.   }
  21.   if (xpos < final_x) {
  22.     var dist = Math.ceil((final_x - xpos)/10);
  23.     xpos = xpos + dist;
  24.   }
  25.   if (xpos > final_x) {
  26.     var dist = Math.ceil((xpos - final_x)/10);
  27.     xpos = xpos - dist;
  28.   }
  29.   if (ypos < final_y) {
  30.     var dist = Math.ceil((final_y - ypos)/10);
  31.     ypos = ypos + dist;
  32.   }
  33.   if (ypos > final_y) {
  34.     var dist = Math.ceil((ypos - final_y)/10);
  35.     ypos = ypos - dist;
  36.   }
  37.   elem.style.left = xpos + "px";
  38.   elem.style.top = ypos + "px";
  39.   var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
  40.   elem.movement = setTimeout(repeat,interval);
  41. }
  42. function classNormal(){
  43. var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
  44. for(var i=0; i<focusBtnList.length; i++) {
  45.   focusBtnList[i].className='';
  46. }
  47. }
  48. function focusChange() {
  49. var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
  50.   focusBtnList[0].onmouseover = function() {
  51.    moveElement('focus_change_list',0,0,5);
  52.    classNormal()
  53.    focusBtnList[0].className='current'
  54.   }
  55.   focusBtnList[1].onmouseover = function() {
  56.    moveElement('focus_change_list',-320,0,5);
  57.    classNormal()
  58.    focusBtnList[1].className='current'
  59.   }
  60.   focusBtnList[2].onmouseover = function() {
  61.    moveElement('focus_change_list',-640,0,5);
  62.    classNormal()
  63.    focusBtnList[2].className='current'
  64.   }
  65.   focusBtnList[3].onmouseover = function() {
  66.    moveElement('focus_change_list',-960,0,5);
  67.    classNormal()
  68.    focusBtnList[3].className='current'
  69.   }
  70. }
  71. setInterval('autoFocusChange()', 5000);
  72. var atuokey = false;
  73. function autoFocusChange() {
  74. $('focus_change').onmouseover = function(){atuokey = true}
  75. $('focus_change').onmouseout = function(){atuokey = false}
  76. if(atuokey) return;
  77. var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
  78. for(var i=0; i<focusBtnList.length; i++) {
  79.   if (focusBtnList[i].className == 'current') {
  80.    var currentNum = i;
  81.   }
  82. }
  83. if (currentNum==0 ){
  84.   moveElement('focus_change_list',-320,0,5);
  85.   classNormal()
  86.   focusBtnList[1].className='current'
  87. }
  88. if (currentNum==1 ){
  89.   moveElement('focus_change_list',-640,0,5);
  90.   classNormal()
  91.   focusBtnList[2].className='current'
  92. }
  93. if (currentNum==2 ){
  94.   moveElement('focus_change_list',-960,0,5);
  95.   classNormal()
  96.   focusBtnList[3].className='current'
  97. }
  98. if (currentNum==3 ){
  99.   moveElement('focus_change_list',0,0,5);
  100.   classNormal()
  101.   focusBtnList[0].className='current'
  102. }
  103. }
  104. function autoFocusChange() {
  105. $('focus_change').onmouseover = function(){atuokey = true}
  106. $('focus_change').onmouseout = function(){atuokey = false}
  107. if(atuokey) return;
  108. var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
  109. for(var i=0; i<focusBtnList.length; i++) {
  110.   if (focusBtnList[i].className == 'current') {
  111.    var currentNum = i;
  112.   }
  113. }
  114. if (currentNum==0 ){
  115.   moveElement('focus_change_list',-320,0,5);
  116.   classNormal()
  117.   focusBtnList[1].className='current'
  118.   focusBtnList[1].className='focus_change_btn1'
  119. }
  120. if (currentNum==1 ){
  121.   moveElement('focus_change_list',-640,0,5);
  122.   classNormal()
  123.   focusBtnList[2].className='current'
  124. }
  125. if (currentNum==2 ){
  126.   moveElement('focus_change_list',-960,0,5);
  127.   classNormal()
  128.   focusBtnList[3].className='current'
  129. }
  130. if (currentNum==3 ){
  131.   moveElement('focus_change_list',0,0,5);
  132.   classNormal()
  133.   focusBtnList[0].className='current'
  134. }
  135. }
  136. </script>
  137. <style type="text/css">
  138. /* Reset style */
  139. * { margin:0; padding:0; word-break:break-all; }
  140. body { background:#FFF; color:#333; font:12px/1.6em Helvetica, Arial, sans-serif; }
  141. h1, h2, h3, h4, h5, h6 { font-size:1em; }
  142. a { color:#039; text-decoration:none; }
  143. a:hover { text-decoration:underline; }
  144. ul, li { list-style:none; }
  145. fieldset, img { border:none; }
  146. em, strong, cite, th { font-style:normal; font-weight:normal; }
  147. /* Focus_change style */
  148. #focus_change { position:relative; width:320px; height:400px; overflow:hidden; margin:20px 0 1px 60px; }
  149. #focus_change_list { position:absolute; width:1800px; height:330px; }
  150.   #focus_change_list li { float:left; }
  151.   #focus_change_list li img { width:320px; height:330px; }

  152. .focus_change_opacity { position:absolute; width:320px; height:80px; top:330px; left:0; background:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
  153. .focus_change_opacity1 { position:absolute; width:320px; height:30px; top:290px; left:0; background:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
  154. #focus_change_btn { position:absolute; width:320px; height:65px; top:318px;}
  155.   #focus_change_btn ul { padding-left:3px; }
  156.   #focus_change_btn li { display:inline; float:left; margin:0 1px; padding-top:12px; }
  157.   #focus_change_btn li a img { width:72px; height:65px; border:2px solid #888; }
  158.   #focus_change_btn li a img span{ float:left; padding-top:12px;}
  159.   #focus_change_btn .current { background:url(6C164133877.gif) no-repeat 37px 8px;}
  160.   #focus_change_btn .current img { border-color:#EEE; }
  161.   
  162. .img_item{float:left;width:320px;position:relative;}
  163. .img_item img{ width:320px; height:330px; }  
  164. .desc{z-index:10; float:left;width:320px;color:#fff;position:absolute;top:295px;}
  165. .desc a{color:#fff;}
  166. .desc H5{font-SIZE:18px; padding-left:10px}  
  167. </style>
复制代码
演示地址如下http://www.36902.com/


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
wupeng 发表于 2011-6-23 19:11:35 | 显示全部楼层
沙发
回复

使用道具 举报

twhll1 发表于 2011-6-23 19:15:59 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

平潭 发表于 2011-6-23 19:51:32 来自手机 | 显示全部楼层
喜欢哈 顶一个
回复

使用道具 举报

nimeilai 发表于 2011-6-23 20:00:11 | 显示全部楼层
没有图么?
回复

使用道具 举报

平潭 发表于 2011-6-23 22:14:26 | 显示全部楼层
谢谢分享,收藏了!
回复

使用道具 举报

dddgm 发表于 2011-6-25 19:34:46 | 显示全部楼层
不错,谢谢分享
回复

使用道具 举报

忆苦似流水 发表于 2011-7-22 20:57:24 | 显示全部楼层
回复

使用道具 举报

jm7491 发表于 2011-9-11 20:03:43 | 显示全部楼层
说的不清不楚
回复

使用道具 举报

炖骨头 发表于 2011-9-11 20:06:06 | 显示全部楼层
不错,学习一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-26 23:20 , Processed in 0.286937 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表