已掉线,重新登录

首页 > 绿虎论坛 > 历史版块 > 编程 > PHP > 讨论/求助

标题: 帖子中的查看全部 折叠内容怎么搞的?

作者: @Ta

时间: 2017-09-06

点击: 3183

@?

[隐藏样式|查看源码]


『回复列表(6|隐藏机器人聊天)』

1.
用户被禁言,发言自动屏蔽。
(/@Ta/2017-09-06 00:12//
被禁言
)

2. @无期徒刑,大佬,css都能实现?
(/@Ta/2017-09-06 00:42//)

3.

@大尨,弄个框框把内容框住,超过一定字符折叠
小米5s Plus(拉丝深灰)

(/@Ta/2017-09-06 07:48//)

4. 我呢第一理解:
在林子里,你发帖篇幅大会自动折叠的,不用怎么搞,
(/@Ta/2017-09-06 07:56//)

5.
<script>
	function foldFold(floor) {
		var content = document.getElementById('floor_content_' + floor);
		var foldBar = document.getElementById('floor_fold_bar_' + floor);
		
		content.style.maxHeight = '768px';
		foldBar.innerHTML = '<a id="floor_expand_' + floor +
				'" href="#" onclick="foldExpand(' + floor + ');return false">查看全部</a>';
	}
	
	function foldExpand(floor) {
		var content = document.getElementById('floor_content_' + floor);
		var foldBar = document.getElementById('floor_fold_bar_' + floor);
		
		content.style.maxHeight = '';
		foldBar.innerHTML = '<a id="floor_fold_' + floor +
				'" href="#" onclick="foldFold(' + floor + ');return false">折叠内容</a>';
	}
	
	function foldFloorInit(floor) {
		var content = document.getElementById('floor_content_' + floor);
		var height = content.offsetHeight;
		
		if (height > 768) {
			var foldBar = document.getElementById('floor_fold_bar_' + floor);
			
			foldBar.style.borderTop = '1px solid #BED8EA';
			foldBar.style.borderBottom = '1px solid #BED8EA';
			foldBar.style.height = '24px';
			foldBar.style.textAlign = 'center';
			
			foldFold(floor);
		}
	}
	
	function foldFloorOnload(floorSize) {
		var i;
		
		for (i=0; i<floorSize; i++) {
			foldFloorInit(i);
		}
	}
</script>
<script>
    function atAdd(uid,that) {
        that.style.color = "#FFA500";
        var nr = document.getElementById("content");
        nr.value += "@"+uid+",";
    }
</script>
		<div class="floor_content" id="floor_content_0">
[文章正文.....]
</div>
		<div class="floor_fold_bar" id="floor_fold_bar_0"></div>
		<script>foldFloorInit(0)</script>
@大尨,这是老虎的源码,自行研究吧
(/@Ta/2017-09-06 17:33//)

6. Overview : hidden; 
(/@Ta/2017-09-06 18:54//)

回复需要登录

8月30日 04:48 星期六

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1