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

 找回密码
 立即注册
搜索

SS7.0测试版之BBS相当不错的幻灯片,全代码复制即可使用

[复制链接]
天婷a 发表于 2009-11-20 01:10:40 | 显示全部楼层 |阅读模式
本帖最后由 天婷a 于 2009-11-20 13:01 编辑

熬夜转风格,不小心看见用测试版时的风格,就把这个幻灯片给折了下来,现在我也用到我八卦频道去了,呵呵,帖出来,有喜欢的就拿去用,这是官方默认代码,我只是修改了大小。

小建议:你可以设置调用指定的图片,比如精华I 。然后,把你想要在这个幻灯片显示出图片的资讯设置精华I,同时制作合适的图片,并在发布资讯时,将要显示在这个幻灯片里的图片作为第一张上传,
TT截图未命名.jpg

  1. 模板中写入

  2. <div class="col410">
  3.                 <div id="supehot">
  4.                         <!--{block name="spacenews" parameter="haveattach/2/order/i.dateline DESC/limit/0,4/cachetime/83400/subjectlen/40/subjectdot/1/cachename/hotnewspic"}-->
  5.                         <div class="box_l" id="index_focus_turn">
  6.                                 <!--{if !empty($_SBLOCK['hotnewspic'])}-->
  7.                                 <div id="index_focus_turn_pic">
  8.                                         <div id="index_focus_turn_picList" style="left:0; top:0;">
  9.                                                 <ul>
  10.                                                         <!--{loop $_SBLOCK['hotnewspic'] $pkey $pvalue}-->
  11.                                                         <li><a href="$pvalue[url]"><img src="$pvalue['a_filepath']" alt="" /></a></li>
  12.                                                         <!--{/loop}-->
  13.                                                 </ul>
  14.                                         </div>
  15.                                         <div id="index_focus_turn_opvdiv"></div>
  16.                                         <div id="index_focus_turn_tx">
  17.                                                 <ul>
  18.                                                 <!--{eval $i = 0}-->
  19.                                                 <!--{loop $_SBLOCK['hotnewspic'] $key $value}-->
  20.                                                         <!--{eval $current = ($i == 0 ? 'current' : 'normal');}-->
  21.                                                         <li class="$current">$value[subject]</li>
  22.                                                         <!--{eval $i++}-->
  23.                                                 <!--{/loop}-->
  24.                                                 </ul>
  25.                                         </div>
  26.                                 </div>
  27.                                 <div id="index_focus_turn_btn">
  28.                                         <ul>
  29.                                                 <!--{eval $i = 0}-->
  30.                                                 <!--{loop $_SBLOCK['hotnewspic'] $bkey $bvalue}-->
  31.                                                 <!--{eval $current = ($i == 0 ? 'current' : 'normal');}-->
  32.                                                 <li class="$current"><img src="$bvalue[a_thumbpath]" alt="" /></li>
  33.                                                 <!--{eval $i++}-->
  34.                                                 <!--{/loop}-->
  35.                                         </ul>
  36.                                 </div>
  37.                                 <!--{/if}-->
  38.                         </div>
  39.                 </div>
  40. </div><!--col410-->
复制代码
以下CSS属性代码,复制到CSS文件的最底部,注意,是最底部,防止CSS属性冲突。

  1. CSS样式:


  2. #index_focus_turn { border:1px solid #DEDEDE; background:#F8F8F8; }
  3.         #index_focus_turn_pic { display:inline; position:relative; float:left; width:470px; height:225px; overflow:hidden; margin:10px 0 0 10px; }
  4.                 #index_focus_turn_picList { position:absolute; }
  5.                 #index_focus_turn_picList li { width:470px; height:225px; overflow:hidden; }
  6.                 #index_focus_turn_picList img { width: expression(470 / this.width * this.height > 225 ? 470 : this.width * 225 / this.height);  max-width: 410px; min-width: 410px;}
  7.         #index_focus_turn_btn { display:inline; float:right; width:91px; margin:9px 9px 0 0; }
  8.                 #index_focus_turn_btn li { width:91px; height:57px; cursor:pointer; filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; }
  9.                 #index_focus_turn_btn img { width:75px; height:45px; margin:7px 0 0 11px; }
  10.                 #index_focus_turn_btn .current { background:url(../images/focus_trun_btnbg.gif) no-repeat; filter:alpha(opacity=100); -moz-opacity:1.0; opacity:1.0; }
  11.         #index_focus_turn_opvdiv { position:absolute; left:0; bottom:0; width:470px; height:25px; background:#fff; filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; }
  12.         #index_focus_turn_tx { position:absolute; left:8px; bottom:2px; color:#000; }
  13.                 #index_focus_turn_tx span { font-size:12px !important; }
  14.                 #index_focus_turn_tx .normal { display:none; }
  15.                 .column{ border:0px # solid}
  16. .col410{ width:583px; overflow:hidden; float:left;}
复制代码
图片不动,是忘了JS了,把JS放进去就可以了
  1. function addLoadEvent(func){
  2.         var oldonload = window.onload;
  3.         if (typeof window.onload != 'function') {
  4.                 window.onload = func;
  5.         } else {
  6.                 window.onload = function(){
  7.                         oldonload();
  8.                         func();
  9.                 }
  10.         }
  11. }

  12. function moveElement(elementID,final_x,final_y,interval) {
  13.   if (!document.getElementById) return false;
  14.   if (!document.getElementById(elementID)) return false;
  15.   var elem = document.getElementById(elementID);
  16.   if (elem.movement) {
  17.     clearTimeout(elem.movement);
  18.   }
  19.   if (!elem.style.left) {
  20.     elem.style.left = "0px";
  21.   }
  22.   if (!elem.style.top) {
  23.     elem.style.top = "0px";
  24.   }
  25.   var xpos = parseInt(elem.style.left);
  26.   var ypos = parseInt(elem.style.top);
  27.   if (xpos == final_x && ypos == final_y) {
  28.                 return true;
  29.   }
  30.   if (xpos < final_x) {
  31.     var dist = Math.ceil((final_x - xpos)/2);
  32.     xpos = xpos + dist;
  33.   }
  34.   if (xpos > final_x) {
  35.     var dist = Math.ceil((xpos - final_x)/2);
  36.     xpos = xpos - dist;
  37.   }
  38.   if (ypos < final_y) {
  39.     var dist = Math.ceil((final_y - ypos)/2);
  40.     ypos = ypos + dist;
  41.   }
  42.   if (ypos > final_y) {
  43.     var dist = Math.ceil((ypos - final_y)/2);
  44.     ypos = ypos - dist;
  45.   }
  46.   elem.style.left = xpos + "px";
  47.   elem.style.top = ypos + "px";
  48.   var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
  49.   elem.movement = setTimeout(repeat,interval);
  50. }

  51. function classNormal(focus_turn_btn,focus_turn_tx){
  52.         var focusBtnList = $(focus_turn_btn).getElementsByTagName('li');
  53.         var focusTxList = $(focus_turn_tx).getElementsByTagName('li');
  54.         for(var i=0; i<focusBtnList.length; i++) {
  55.                 focusBtnList[i].className='normal';
  56.                 focusTxList[i].className='normal';
  57.         }
  58. }

  59. function classCurrent(focus_turn_btn,focus_turn_tx,n){
  60.         var focusBtnList = $(focus_turn_btn).getElementsByTagName('li');
  61.         var focusTxList = $(focus_turn_tx).getElementsByTagName('li');
  62.         focusBtnList[n].className='current';
  63.         focusTxList[n].className='current';
  64. }

  65. function newsfocusChange() {
  66.         if(!$('news_focus_turn')||!$('news_focus_turn_btn')) return;
  67.         $('news_focus_turn').onmouseover = function(){atuokey = true};
  68.         $('news_focus_turn').onmouseout = function(){atuokey = false};
  69.         var focusBtnList = $('news_focus_turn_btn').getElementsByTagName('li');
  70.         if(!focusBtnList||focusBtnList.length==0) return;
  71.         var listLength = focusBtnList.length;
  72.                 focusBtnList[0].onmouseover = function() {
  73.                         moveElement('news_focus_turn_picList',0,0,5);
  74.                         classNormal('news_focus_turn_btn','news_focus_turn_tx');
  75.                         classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
  76.                 }
  77.         if (listLength>=2) {
  78.                 focusBtnList[1].onmouseover = function() {
  79.                         moveElement('news_focus_turn_picList',-400,0,5);
  80.                         classNormal('news_focus_turn_btn','news_focus_turn_tx');
  81.                         classCurrent('news_focus_turn_btn','news_focus_turn_tx',1)
  82.                 }
  83.         }
  84.         if (listLength>=3) {
  85.                 focusBtnList[2].onmouseover = function() {
  86.                         moveElement('news_focus_turn_picList',-800,0,5);
  87.                         classNormal('news_focus_turn_btn','news_focus_turn_tx');
  88.                         classCurrent('news_focus_turn_btn','news_focus_turn_tx',2)
  89.                 }
  90.         }
  91.         if (listLength>=4) {
  92.                 focusBtnList[3].onmouseover = function() {
  93.                         moveElement('news_focus_turn_picList',-1200,0,5);
  94.                         classNormal('news_focus_turn_btn','news_focus_turn_tx');
  95.                         classCurrent('news_focus_turn_btn','news_focus_turn_tx',3)
  96.                 }
  97.         }
  98. }

  99. setInterval('newsautoFocusChange()', 5000);
  100. var atuokey = false;
  101. function newsautoFocusChange() {
  102.         if(!$('news_focus_turn_btn')) return;
  103.         if(atuokey) return;
  104.         var focusBtnList = $('news_focus_turn_btn').getElementsByTagName('li');
  105.         var listLength = focusBtnList.length;
  106.         for(var i=0; i<focusBtnList.length; i++) {
  107.                 if (focusBtnList[i].className == 'current') var currentNum = i;
  108.         }
  109.         if (currentNum==0&&listLength!=1 ){
  110.                 moveElement('news_focus_turn_picList',-400,0,5);
  111.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  112.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',1)
  113.         }
  114.         if (currentNum==1&&listLength!=2 ){
  115.                 moveElement('news_focus_turn_picList',-800,0,5);
  116.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  117.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',2)
  118.         }
  119.         if (currentNum==2&&listLength!=3 ){
  120.                 moveElement('news_focus_turn_picList',-1200,0,5);
  121.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  122.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',3)
  123.         }
  124.         if (currentNum==3){
  125.                 moveElement('news_focus_turn_picList',0,0,5);
  126.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  127.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
  128.         }
  129.         if (currentNum==1&&listLength==2 ){
  130.                 moveElement('news_focus_turn_picList',0,0,5);
  131.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  132.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
  133.         }
  134.         if (currentNum==2&&listLength==3 ){
  135.                 moveElement('news_focus_turn_picList',0,0,5);
  136.                 classNormal('news_focus_turn_btn','news_focus_turn_tx');
  137.                 classCurrent('news_focus_turn_btn','news_focus_turn_tx',0)
  138.         }
  139. }

  140. function indexfocusChange() {
  141.         if(!$('index_focus_turn')||!$('index_focus_turn_btn')) return;
  142.         $('index_focus_turn').onmouseover = function(){atuokey = true};
  143.         $('index_focus_turn').onmouseout = function(){atuokey = false};
  144.         var focusBtnList = $('index_focus_turn_btn').getElementsByTagName('li');
  145.         if(!focusBtnList||focusBtnList.length==0) return;
  146.         var listLength = focusBtnList.length;
  147.                 focusBtnList[0].onmouseover = function() {
  148.                         moveElement('index_focus_turn_picList',0,0,5);
  149.                         classNormal('index_focus_turn_btn','index_focus_turn_tx');
  150.                         classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
  151.                 }
  152.         if (listLength>=2) {
  153.                 focusBtnList[1].onmouseover = function() {
  154.                         moveElement('index_focus_turn_picList',0,-225,5);
  155.                         classNormal('index_focus_turn_btn','index_focus_turn_tx');
  156.                         classCurrent('index_focus_turn_btn','index_focus_turn_tx',1);
  157.                 }
  158.         }
  159.         if (listLength>=3) {
  160.                 focusBtnList[2].onmouseover = function() {
  161.                         moveElement('index_focus_turn_picList',0,-450,5);
  162.                         classNormal('index_focus_turn_btn','index_focus_turn_tx');
  163.                         classCurrent('index_focus_turn_btn','index_focus_turn_tx',2);
  164.                 }
  165.         }
  166.         if (listLength>=4) {
  167.                 focusBtnList[3].onmouseover = function() {
  168.                         moveElement('index_focus_turn_picList',0,-675,5);
  169.                         classNormal('index_focus_turn_btn','index_focus_turn_tx');
  170.                         classCurrent('index_focus_turn_btn','index_focus_turn_tx',3);
  171.                 }
  172.         }
  173. }

  174. setInterval('indexautoFocusChange()',5000);
  175. var atuokey = false;
  176. function indexautoFocusChange() {
  177.         if(!$('index_focus_turn')||!$('index_focus_turn_btn')) return;
  178.         if(atuokey) return;
  179.         var focusBtnList = $('index_focus_turn_btn').getElementsByTagName('li');
  180.         var listLength = focusBtnList.length;
  181.         for(var i=0; i<listLength; i++) {
  182.                 if (focusBtnList[i].className == 'current') var currentNum = i;
  183.         }
  184.         if (currentNum==0&&listLength!=1 ){
  185.                 moveElement('index_focus_turn_picList',0,-225,5);
  186.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  187.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',1);
  188.         }
  189.         if (currentNum==1&&listLength!=2 ){
  190.                 moveElement('index_focus_turn_picList',0,-450,5);
  191.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  192.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',2);
  193.         }
  194.         if (currentNum==2&&listLength!=3 ){
  195.                 moveElement('index_focus_turn_picList',0,-675,5);
  196.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  197.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',3);
  198.         }
  199.         if (currentNum==3 ){
  200.                 moveElement('index_focus_turn_picList',0,0,5);
  201.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  202.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
  203.         }
  204.         if (currentNum==1&&listLength==2 ){
  205.                 moveElement('index_focus_turn_picList',0,0,5);
  206.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  207.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
  208.         }
  209.         if (currentNum==2&&listLength==3 ){
  210.                 moveElement('index_focus_turn_picList',0,0,5);
  211.                 classNormal('index_focus_turn_btn','index_focus_turn_tx');
  212.                 classCurrent('index_focus_turn_btn','index_focus_turn_tx',0);
  213.         }
  214. }
  215. addLoadEvent(newsfocusChange);
  216. addLoadEvent(indexfocusChange);
复制代码
回复

使用道具 举报

理红轩 发表于 2009-11-20 05:38:06 | 显示全部楼层
不行啊,图片不动~~
回复

使用道具 举报

Gnagno 发表于 2009-11-20 07:16:37 | 显示全部楼层
这样的幻灯,一般都需要手工加信息的,否则会变形影响美观的
回复

使用道具 举报

 楼主| 天婷a 发表于 2009-11-20 12:32:37 | 显示全部楼层
小建议:你可以设置调用指定的图片,比如精华I 。然后,把你想要在这个幻灯片显示出图片的资讯设置精华I,同时制作合适的图片,并在发布资讯时,将要显示在这个幻灯片里的图片作为第一张上传,
回复

使用道具 举报

neol123 发表于 2009-11-20 13:22:08 | 显示全部楼层
做风格就是搞不清楚 这个幻灯片调用的问题!
有些汗颜!

到底怎么做?
这个JS 放在哪儿?放在另外一个文件夹吗?

还有那个幻灯片很漂亮如果我要幻灯片右侧的四个小图片 在幻灯片下面显示呢?而不是右侧呢?怎么修改
回复

使用道具 举报

有事网 发表于 2009-11-20 13:43:12 | 显示全部楼层
这样的幻灯,一般都需要手工加信息的,否则会变形影响美观的
Gnagno 发表于 2009-11-20 07:16



    ((em:14)) ((em:14))
回复

使用道具 举报

jiangxiaoli 发表于 2009-11-20 19:22:18 | 显示全部楼层
本帖最后由 jiangxiaoli 于 2009-11-20 19:23 编辑

顶起来~希望官方做个精美的幻灯片~
回复

使用道具 举报

china2008sc 发表于 2009-11-21 10:08:37 | 显示全部楼层
复杂哦..........
回复

使用道具 举报

理红轩 发表于 2009-11-21 14:35:34 | 显示全部楼层
不想用幻灯片了,不过还是要支持一下!这个幻灯片很漂亮!

JS 放在模板中就行。另外,用审核级别调用图片也不错。
回复

使用道具 举报

sunj85 发表于 2009-11-21 14:39:58 | 显示全部楼层
回复 7# jiangxiaoli

看看这个
   
https://discuz.dismall.com/thread-1488592-1-1.html
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 15:44 , Processed in 0.132400 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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