本帖最后由 兔儿火花 于 2008-11-10 16:34 编辑
以下代码可能存在不足,我第一次做插件有什么可以提出来共同研究。
如果你未能完成也可加我QQ寻求帮助。
觉的好您就用
不好也不要骂!
演示网站:
http://www.xingyang.cn
http://www.xingyang.cn/space-222-do-album-picid-110.html
template/default/common.css
打在在最后面加上- #divleft {
- border:0px red solid;
- position:absolute;
- z-index:2007;
- text-align:right;
- padding-top:20px
- padding-left:20px
- }
- #divright {
- border:0px red solid;
- position:absolute;
- z-index:2007
- text-align:center;
- padding-top:20px
- padding-left:20px
- }
- #tu{z-index:-2007;
- }
复制代码 source/space_album.php
查找:
- //图片不存在
- if(empty($pic)) {
- showmessage('view_images_do_not_exist');
- }
复制代码 在下面添加- //仿照腾讯QQ空间相册特效代码 by fgpgy QQ2866820 http://www.xingyang.cn
- //Start
- $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('pic')." WHERE albumid ='$pic[albumid]' AND
- uid='$space[uid]' order by picid desc");
- $listpicnum=$_SGLOBAL['db']->num_rows($query);
- $listpicnum1=$listpicnum+1;
- $k=1;
- while($listpic = $_SGLOBAL['db']->fetch_array($query))
- {
- $listpic['filepath']="pic_url_show[$k]='attachment/$listpic[filepath]'\n";
- $listpics[] = $listpic;
- $k++;
- }
- //End
- //仿腾讯QQ空间相册特效代码结束
复制代码 /template/default/space_album_pic.htm
查找:
- <div class="photobox">
- <a href="space.php?uid=$pic[uid]&do=album&picid=$pic[picid]&goto=down"><img src="$pic[pic]" alt="$pic[title]" /></a>
- </div>
-
复制代码 替换为:
- <div class="photobox">
- <div id="divall" >
- <img src="$pic[pic]" id="tu" onmousemove="show_who(this,event)" onclick="click_who()">
- </div>
- <script>
- document.write ("<div style='z-index:2007;visibility:hidden;border:2px solid #f66;background-color:#efefef;font-size:14px;position:absolute;Padding-bottom:4px;Padding-LEFT: 5px;Padding-right:5px;Padding-top:7px;left:-200px;top:180px;width:100px;bottom:1;text-align:center;' id=titlelayer></div>");
- var pic_url_show=new Array()
- <!--{loop $listpics $key $value}-->
- $value['filepath']
- <!--{/loop}-->
- var left0=50
- var height0=50
- var zhang=1
- var evt_left,evt_top;
- function show_who(o,evt){//alert(o.style.cursor.match("pre"))
- evt = evt? evt: window.event;initX = evt.offsetX ? evt.offsetX : evt.layerX;
- evt_left=o.clientWidth/2
- evt_top=o.clientHeight/2
- if(initX <= o.clientWidth/2 && zhang>1){if( o.style.cursor != "url(image/pre.ani),pointer")o.style.cursor = "url(image/pre.ani),pointer";if( o.title != "点击跳到上一张" ){o.title = "点击跳到上一张";}}
- else if( o.style.cursor!="url(image/next.ani),pointer"&& zhang<(pic_url_show.length-1)){o.style.cursor="url(image/next.ani),pointer";if( o.title != "点击跳到下一张" ){o.title = "点击跳到下一张";}}
- return;
- }
- function click_who(){
- if (event.x<=evt_left){pre();}
- else {next();}
- }
- function next(){
- zhang++
- if(zhang>=$listpicnum1){zhang=$listpicnum;alert_me("这是最后一张");document.getElementById("tu").title = ""}
- document.getElementById("tu").src=pic_url_show[zhang]
- }
- function pre(){
- zhang--
- if(zhang<=0){zhang=1;alert_me("这是第一张");document.getElementById("tu").title = ""}
- document.getElementById("tu").src=pic_url_show[zhang]
- }
- function alert_me(textis){
- var obj_titlel=document.getElementById('titlelayer')
- obj_titlel.innerHTML=textis
- obj_titlel.style.visibility='visible';
- obj_titlel.style.left=evt_left-50;
- obj_titlel.style.top=evt_top;
- setTimeout ("document.getElementById('titlelayer').style.visibility='hidden';document.getElementById('titlelayer').style.left=-200;",1500)
-
- }
- </script>
- </div>
复制代码 将pre.ani next.ani上传到/image下面
注意:某些IIS不支持.ani后缀需修改
方法如下:
打开站点--HTTP头--MIME类型--新建--扩展名ani MIME类型ani确定即可!
完整包下载地址:
http://www.zhangerbao.cn/attachment.php?id=97 |