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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 提前体验Discuz!清新版闪亮登场

[复制链接]
anxiangxu 发表于 2012-4-9 14:04:51 | 显示全部楼层
不错,支持X2.0吗?
回复

使用道具 举报

 楼主| penlau 发表于 2012-4-9 14:09:41 | 显示全部楼层
anxiangxu 发表于 2012-4-9 14:04
不错,支持X2.0吗?

不知道,没试过。不过不会破坏原文件。·
回复

使用道具 举报

kabilong 发表于 2012-4-9 14:14:53 | 显示全部楼层
我只有浏览帖子的图片模式是瀑布流,这样怎么设置?盼复
回复

使用道具 举报

 楼主| penlau 发表于 2012-4-9 14:18:48 | 显示全部楼层
kabilong 发表于 2012-4-9 14:14
我只有浏览帖子的图片模式是瀑布流,这样怎么设置?盼复

装了这个模版 开启图片模式就是官方现在图片演示板块的样子了。哈哈!!
回复

使用道具 举报

kabilong 发表于 2012-4-9 14:20:25 | 显示全部楼层
penlau 发表于 2012-4-9 14:18
装了这个模版 开启图片模式就是官方现在图片演示板块的样子了。哈哈!!

其他的我都不要,我只有“瀑布流”的
回复

使用道具 举报

 楼主| penlau 发表于 2012-4-9 14:24:19 | 显示全部楼层
kabilong 发表于 2012-4-9 14:20
其他的我都不要,我只有“瀑布流”的

给一点思路 和一些代码 自己想去。
回复

使用道具 举报

 楼主| penlau 发表于 2012-4-9 14:24:58 | 显示全部楼层
kabilong 发表于 2012-4-9 14:20
其他的我都不要,我只有“瀑布流”的

给一点思路 和一些代码 自己想去。
回复

使用道具 举报

 楼主| penlau 发表于 2012-4-9 14:25:58 | 显示全部楼层
kabilong 发表于 2012-4-9 14:20
其他的我都不要,我只有“瀑布流”的

/*
piclist                {"parent": 父元素, "list": 图片数组}
container                放置瀑布流的父容器
maxcolumn                最多多少列
space                        图片间距
index                        从第几张开始排列

返回值
index                        当前瀑布流已经排列了多少个图片
totalwidth                当前瀑布流的总宽度
totalheight        当前瀑布流的总高度
*/
function waterfall(v) {
        if(typeof(v.piclist) == "undefined") return;
        var column = 1;
        var totalwidth = typeof(v.totalwidth) == "undefined" ? 0 : v.totalwidth;
        var totalheight = typeof(v.totalheight) == "undefined" ? 0 : v.totalheight;
        var container = typeof(v.container) == "undefined" ? $("threadlist") : v.container;
        var maxcolumn = typeof(v.maxcolumn) == "undefined" ? 0 : v.maxcolumn;
        var space = typeof(v.space) == "undefined" ? 10 : v.space;
        var index = typeof(v.index) == "undefined" ? 0 : v.index;
        var tag = "";
        var totalelem = [];
        var tmpx = 0;
        var tmpy = 0;
        if(piclist.list.length > 0) {
                tag = piclist.list[0].tagName;
                totalelem = piclist.parent.getElementsByTagName(tag);
                column = Math.floor((container.offsetWidth - space) / (piclist.list[0].offsetWidth + space));
                if(maxcolumn && column > maxcolumn) {
                        column = maxcolumn;
                }
                if(!column) {
                        column = 1;
                }
                for(var i = index; i < totalelem.length; i++) {
                        tmpx = i % column;
                        tmpy = Math.floor(i / column);
                        totalelem.style.position = "absolute";
                        //如果是第一列则为 0,否则就取当前元素左侧的元素的位置加上宽度
                        totalelem.style.left = tmpx ? totalelem[i - 1].offsetLeft + totalelem[i - 1].offsetWidth + space + "px" : 0;
                        totalwidth = (totalelem[0].offsetWidth + space) * column - space;
                        //如果是第一行则为 0,否则就取当前元素正上方的元素的位置加上高度
                        totalelem.style.top = tmpy ? totalelem[i - column].offsetTop + totalelem[i - column].offsetHeight + space + "px" : 0;
                        totalheight = Math.max(totalheight, totalelem.offsetTop + totalelem.offsetHeight);
                        index++;
                }
                piclist.parent.style.height = totalheight + space + "px";
                piclist.parent.style.width = totalwidth + "px";
        }
        return {"index": index, "totalwidth": totalwidth, "totalheight": totalheight};
}

function getPiclist(id, tag) {
        id = id || "waterfall";
        return {"parent": $(id), "list": $(id).getElementsByTagName(tag)};
}
回复

使用道具 举报

kabilong 发表于 2012-4-9 14:26:44 | 显示全部楼层
penlau 发表于 2012-4-9 14:24
给一点思路 和一些代码 自己想去。

这个是回答吗?
回复

使用道具 举报

kabilong 发表于 2012-4-9 14:27:39 | 显示全部楼层
penlau 发表于 2012-4-9 14:25
/*
piclist                {"parent": 父元素, "list": 图片数组}
container                放置瀑布流的父容器

谢谢谢谢谢谢
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-30 01:34 , Processed in 0.955288 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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