二级回复展开更多效果实现

This commit is contained in:
Tim 2016-05-06 16:20:39 +08:00
parent 17a9de8ec4
commit cd95ed0558
3 changed files with 38 additions and 6 deletions

View File

@ -43,12 +43,39 @@
</div>
<% if count > 3 %>
<div class="sn-reply-more">
<a id="reply_btn_<%= document.id %>" onclick="expand_reply('#newstyle_reply_div_<%= document.id %> li','#reply_btn_<%=document.id%>')" data-count="<%= count %>" data-init="0" href="javascript:void(0)" value="show_help">
展开回复
<a id="reply_btn_<%= document.id %>" onclick="expand_reply('#newstyle_reply_div_<%= document.id %>','#reply_btn_<%=document.id%>')" data-count="<%= count %>" data-init="0" href="javascript:void(0)" value="show_help">
展开更多
</a>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
<script>
$(document).ready(function(){
var replyCount = $(".sn-comment-listbox").size();
if (replyCount >3){
for(var i= 3; i < replyCount+1; i++){
$(".sn-comment-listbox").eq(i).hide();
}
}
});
function expand_reply(container, btnid) {
var target = $(container).children();
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
</script>

View File

@ -83,7 +83,7 @@
</div>
<% if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= document.id %>" onclick="expand_reply('#reply_div_<%= document.id %> li','#reply_btn_<%=document.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
<a id="reply_btn_<%= @document.id %>" onclick="expand_reply('#reply_div_<%= @document.id %>','#reply_btn_<%=@document.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
展开更多
</a>
</div>
@ -161,9 +161,15 @@
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
var replyCount = $(".homepagePostReplyContainer").size();
if (replyCount >3){
for(var i= 3; i < replyCount+1; i++){
$(".homepagePostReplyContainer").eq(i).hide();
}
}
});
function expand_reply(container, btnid) {
var target = $(container);
var target = $(container).children(".homepagePostReplyContainer");
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);

View File

@ -62,7 +62,6 @@ a.sn-link-select {color:#809df9;}
.sn-login {width:1200px; height:45px; line-height:45px; margin:0 auto; font-size:14px; color:#24366e; vertical-align:middle; text-align:right;}
.sn-login2 {width:1200px; height:54px; line-height:54px; margin:0 auto; font-size:14px; color:#24366e; vertical-align:middle; text-align:right;}
.sn-logo {width:1200px; height:90px; line-height:90px; margin:0 auto; vertical-align:middle;position:relative;}
.sn-logo-add{ display:block; top:10px; left:0px; position:absolute; width:20px; height:20px;background:url(../images/default_blank/icons-add.png) -0px -3px no-repeat;}
.sn-search-input {width:328px; height:40px; font-size:16px; color:#ccc; padding-left:10px; border:1px solid #ccc; border-right:none; float:right; background-color:#fff; outline:none;}
a.sn-search-button {width:53px; height:40px; border:1px solid #ccc; border-left:none; float:right; outline:none; background:url(../images/sn_search_icon.jpg) 0 3px no-repeat;}
.sn-nav {width:1200px; height:55px; margin:0 auto; font-size:16px; position:relative; line-height:1; overflow:hidden;}