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

 找回密码
 立即注册
搜索

关于相册幻灯片,外部调用的问题!

[复制链接]
南华痞子 发表于 2008-12-17 01:06:52 | 显示全部楼层 |阅读模式
大家好,我才用了几天uchome,不是很懂这个程序,现在遇到个问题就是,我想把uchome的幻灯片放到我的网站首页(我的uchome是在home目录下面的),但是我在后台新建数据调用里面研究了几个小时了,还是没有搞定,原因有以下几种,望知情人士能一一告知,感激不尽了!

第一个:官方自带的幻灯只有修改模板里面的代码才能实现,因为在后台根本不想CMS那样可以建立幻灯片对应的标签直接调用!

第二个:就算自己修改模板里面的幻灯代码,也需要用数据调用里面的数据,然后用JS调用到我的站点首页去,因为不用JS用模板代码调用的话,其他程序是不认识UCHOME的代码的,那么,问题出现了,在循环标签里面要怎样写才能实现呢,本人不才,研究了很久很久都没有对策!
我看了下相册表里面,只有图片地址能调,图片标题和条片连接都没有标签可以用,所以我就一直被这个问题所困扰住了,网站一直没有继续做下去,就停留在这个节点上了!

耗费大量时间还是没有解决办法,希望能够得到各位同仁的帮助,帮帮我过了这一关,在这里先谢过了!
回复

使用道具 举报

 楼主| 南华痞子 发表于 2008-12-18 04:00:39 | 显示全部楼层
没有解决我怎么可能放手
回复

使用道具 举报

nandy 发表于 2009-10-13 01:22:30 | 显示全部楼层
我也遇到这个问题。我来顶。
回复

使用道具 举报

nandy 发表于 2009-10-13 02:36:40 | 显示全部楼层

  1. <style type="text/css">
  2. img{
  3. border:0px;
  4. }
  5. .container, .container *{margin:0; padding:0;}

  6. .container{width:640px; height:200px; overflow:hidden;position:relative;}
  7. .container2{width:232px; height:60px; overflow:hidden;position:relative;}
  8. .slider{position:absolute;}
  9. .slider li{ list-style:none;display:inline;}
  10. .slider img{ width:640px; height:200px; display:block;}
  11. #idSlider img{ width:232px; height:60px; display:block;}
  12. .slider2{width:2100px;}
  13. .slider2 li{float:left;}

  14. .num{ position:absolute; right:5px; bottom:5px;}
  15. .num li{
  16.         float: left;
  17.         color: #333;
  18.         text-align: center;
  19.         line-height: 16px;
  20.         width: 16px;
  21.         height: 16px;
  22.         font-family: Arial;
  23.         font-size: 12px;
  24.         cursor: pointer;
  25.         overflow: hidden;
  26.         margin: 0px 0px;
  27.         border: 0px solid #666;
  28.         background-color: #fff;
  29. }
  30. .num li.on{
  31.         color: #fff;
  32.         line-height: 0px;
  33.         width: 0px;
  34.         height: 0px;
  35.         font-size: 16px;
  36.         margin: 0 0px;
  37.         border: 0;
  38.         background-color: #666;
  39.         font-weight: bold;
  40. }
  41. </style>
  42. <div class="container" id="idTransformView2">
  43.   <ul class="slider slider2" id="idSlider2">
  44.     <li><script language="javascript" type="text/javascript" src="http://www.ztw0870.com/home/js.php?id=3"></script></li>
  45.   </ul>
  46.   <ul class="num" id="idNum12">
  47.     <li>1</li>
  48.     <li>2</li>
  49.     <li>3</li>
  50.         </ul>
  51. </div>
  52. <script type="text/javascript">
  53. var $ = function (id) {
  54.         return "string" == typeof id ? document.getElementById(id) : id;
  55. };

  56. var Class = {
  57.   create: function() {
  58.         return function() {
  59.           this.initialize.apply(this, arguments);
  60.         }
  61.   }
  62. }

  63. Object.extend = function(destination, source) {
  64.         for (var property in source) {
  65.                 destination[property] = source[property];
  66.         }
  67.         return destination;
  68. }

  69. var TransformView = Class.create();
  70. TransformView.prototype = {
  71.   //容器对象,滑动对象,切换参数,切换数量
  72.   initialize: function(container, slider, parameter, count, options) {
  73.         if(parameter <= 0 || count <= 0) return;
  74.         var oContainer = $(container), oSlider = $(slider), oThis = this;

  75.         this.Index = 0;//当前索引
  76.        
  77.         this._timer = null;//定时器
  78.         this._slider = oSlider;//滑动对象
  79.         this._parameter = parameter;//切换参数
  80.         this._count = count || 0;//切换数量
  81.         this._target = 0;//目标参数
  82.        
  83.         this.SetOptions(options);
  84.        
  85.         this.Up = !!this.options.Up;
  86.         this.Step = Math.abs(this.options.Step);
  87.         this.Time = Math.abs(this.options.Time);
  88.         this.Auto = !!this.options.Auto;
  89.         this.Pause = Math.abs(this.options.Pause);
  90.         this.onStart = this.options.onStart;
  91.         this.onFinish = this.options.onFinish;
  92.        
  93.         oContainer.style.overflow = "hidden";
  94.         oContainer.style.position = "relative";
  95.        
  96.         oSlider.style.position = "absolute";
  97.         oSlider.style.top = oSlider.style.left = 0;
  98.   },
  99.   //设置默认属性
  100.   SetOptions: function(options) {
  101.         this.options = {//默认值
  102.                 Up:                        true,//是否向上(否则向左)
  103.                 Step:                7,//滑动变化率
  104.                 Time:                35,//滑动延时
  105.                 Auto:                true,//是否自动转换
  106.                 Pause:                5000,//停顿时间(Auto为true时有效)
  107.                 onStart:        function(){},//开始转换时执行
  108.                 onFinish:        function(){}//完成转换时执行
  109.         };
  110.         Object.extend(this.options, options || {});
  111.   },
  112.   //开始切换设置
  113.   Start: function() {
  114.         if(this.Index < 0){
  115.                 this.Index = this._count - 1;
  116.         } else if (this.Index >= this._count){ this.Index = 0; }
  117.        
  118.         this._target = -1 * this._parameter * this.Index;
  119.         this.onStart();
  120.         this.Move();
  121.   },
  122.   //移动
  123.   Move: function() {
  124.         clearTimeout(this._timer);
  125.         var oThis = this, style = this.Up ? "top" : "left", iNow = parseInt(this._slider.style[style]) || 0, iStep = this.GetStep(this._target, iNow);
  126.        
  127.         if (iStep != 0) {
  128.                 this._slider.style[style] = (iNow + iStep) + "px";
  129.                 this._timer = setTimeout(function(){ oThis.Move(); }, this.Time);
  130.         } else {
  131.                 this._slider.style[style] = this._target + "px";
  132.                 this.onFinish();
  133.                 if (this.Auto) { this._timer = setTimeout(function(){ oThis.Index++; oThis.Start(); }, this.Pause); }
  134.         }
  135.   },
  136.   //获取步长
  137.   GetStep: function(iTarget, iNow) {
  138.         var iStep = (iTarget - iNow) / this.Step;
  139.         if (iStep == 0) return 0;
  140.         if (Math.abs(iStep) < 1) return (iStep > 0 ? 1 : -1);
  141.         return iStep;
  142.   },
  143.   //停止
  144.   Stop: function(iTarget, iNow) {
  145.         clearTimeout(this._timer);
  146.         this._slider.style[this.Up ? "top" : "left"] = this._target + "px";
  147.   }
  148. };

  149. window.onload=function(){
  150.         function Each(list, fun){
  151.                 for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
  152.         };
  153.        
  154.        
  155.         ////////////////////////test2
  156.        
  157.         var objs2 = $("idNum12").getElementsByTagName("li");
  158.        
  159.         var tv2 = new TransformView("idTransformView2", "idSlider2", 690, 3, {
  160.                 onStart: function(){ Each(objs2, function(o, i){ o.className = tv2.Index == i ? "on" : ""; }) },//按钮样式
  161.                 Up: false
  162.         });
  163.        
  164.         tv2.Start();
  165.        
  166.         Each(objs2, function(o, i){
  167.                 o.onmouseover = function(){
  168.                         o.className = "on";
  169.                         tv2.Auto = false;
  170.                         tv2.Index = i;
  171.                         tv2.Start();
  172.                 }
  173.                 o.onmouseout = function(){
  174.                         o.className = "";
  175.                         tv2.Auto = true;
  176.                         tv2.Start();
  177.                 }
  178.         })
  179.        
  180.         $("idStop1").onclick = function(){ tv2.Auto = false; tv2.Stop(); }
  181.         $("idStart1").onclick = function(){ tv2.Auto = true; tv2.Start(); }
  182.         $("idNext1").onclick = function(){ tv2.Index++; tv2.Start(); }
  183.         $("idPre1").onclick = function(){ tv2.Index--;tv2.Start(); }
  184.         $("idFast1").onclick = function(){ if(--tv2.Step <= 0){tv2.Step = 1;} }
  185.         $("idSlow1").onclick = function(){ if(++tv2.Step >= 10){tv2.Step = 10;} }
  186.         $("idReduce1").onclick = function(){ tv2.Pause-=1000; if(tv2.Pause <= 0){tv2.Pause = 0;} }
  187.         $("idAdd1").onclick = function(){ tv2.Pause+=1000; if(tv2.Pause >= 5000){tv2.Pause = 5000;} }
  188.        
  189.         $("idReset1").onclick = function(){
  190.                 tv2.Step = Math.abs(tv2.options.Step);
  191.                 tv2.Time = Math.abs(tv2.options.Time);
  192.                 tv2.Auto = !!tv2.options.Auto;
  193.                 tv2.Pause = Math.abs(tv2.options.Pause);
  194.         }
  195.        
  196. }
  197. </script>
复制代码
这个JS幻灯代码可以外部调用UCH的相册,可是放上去后,不知道怎么的,整个页面都变形了。
回复

使用道具 举报

nandy 发表于 2009-10-13 02:37:01 | 显示全部楼层
请高手改改。谢谢
回复

使用道具 举报

nandy 发表于 2009-10-13 05:24:15 | 显示全部楼层
怎么没人?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-13 08:07 , Processed in 0.085446 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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