资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何基于JavaScript实现评论框展开和隐藏功能-创新互联

这篇文章给大家分享的是有关如何基于JavaScript实现评论框展开和隐藏功能的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

站在用户的角度思考问题,与客户深入沟通,找到长宁网站设计与长宁网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站设计制作、网站制作、企业官网、英文网站、手机端网站、网站推广、空间域名、虚拟空间、企业邮箱。业务覆盖长宁地区。

1.效果图如下所示,

点击评论会在对应的评论区域展开评论输入框,点击取消会取消对应的评论输入框

如何基于JavaScript实现评论框展开和隐藏功能

2.html代码:需要引入jQuery.js

493 条评论
切换为时间排序
知乎用户
这个爬虫真的好强大!
2017.10.01 21:32:30
知乎用户
这个爬虫真的好强大!
2017.10.01 21:32:30
知乎用户
这个爬虫真的好强大!
2017.10.01 21:32:30
知乎用户
这个爬虫真的好强大!
2017.10.01 21:32:30

3.css样式代码,样式无所谓,自己写就可以。

.nr-comment {
width:
100%;
border-right:
1px 
solid #A9A9A9;
border-left:
1px 
solid #A9A9A9;
}
.nr-comment .nr-comment-con {
width:
100%;
}
.nr-comment .nr-comment-con .nr-comment-nav {
width:
100%;
height:
40px;
border-bottom:
1px 
solid #F5F5F6;
border-right:
1px 
solid #A9A9A9;
border-left:
1px 
solid #A9A9A9;
background-color:
#1E8CE0;
}
.nr-comment .nr-comment-con .nr-comment-nav .comment-number {
float:
left;
width:
85px;
height:
30px;
text-align:
center;
margin-top:
5px;
color:
white;
line-height:
2.3em;
}
.nr-comment .nr-comment-con .nr-comment-nav .comment-sort {
float:
right;
width:
110px;
height:
30px;
margin-top:
5px;
margin-right:
10px;
line-height:
2em;
color:
white;
}
.nr-comment .nr-comment-con .comment-content {
width:
100%;
margin-top:
10px;
border-bottom:
1px 
solid #a9a9a9;
}
.nr-comment .nr-comment-con .comment-content .com-users {
width:
100%;
min-height:
60px;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-user {
float:
left;
width:
500px;
height:
60px;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-user span {
color:
black;
margin-left:
10px;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-user .comment-user-content {
width:
90%;
height:
60px;
margin-left:
10px;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-time {
float:
right;
width:
190px;
height:
60px;
text-align:
center;
color:
#9CADC6;
font-size:
0.9em;
text-align:
right;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-time div {
margin-right:
15px;
}
.nr-comment .nr-comment-con .comment-content .com-users .comment-time .btn-reply {
margin-top:
5px;
border-radius:
4px;
border:
none;
background-color:
#1BB394;
color:
white;
margin-right:
15px;
}
.nr-comment .nr-comment-con .comment-content .user-reply {
display:
none;
width:
100%;
height:
50px;
}
.nr-comment .nr-comment-con .comment-content .user-reply .reply-in {
float:
left;
width:
85%;
height:
50px;
}
.nr-comment .nr-comment-con .comment-content .user-reply .reply-in input {
width:
100%;
height:
30px;
margin-top:
10px;
margin-left:
10px;
}
.nr-comment .nr-comment-con .comment-content .user-reply .reply-buttons {
float:
right;
margin-top:
10px;
}
.nr-comment .nr-comment-con .comment-content .user-reply .reply-buttons .btn-comment {
float:
right;
margin-right:
14px;
background-color:
#1BB394;
border:
none;
color:
white;
}
.nr-comment .nr-comment-con .comment-content .user-reply .reply-buttons .btn-cancel {
float:
right;
margin-right:
10px;
}
.nr-comment .nr-comment-con .comment-ipt {
width:
100%;
height:
40px;
border-bottom:
1px 
solid #A9A9A9;
margin-top:
10px;
}
.nr-comment .nr-comment-con .comment-ipt input {
display:
block;
width:
92%;
height:
30px;
float:
left;
font-size:
14px;
margin-left:
10px;
}
.nr-comment .nr-comment-con .comment-ipt button {
display:
block;
float:
right;
background-color:
#1BB394;
color:
white;
margin-right:
13px;
border:
none;
}

4.js控制对应评论按钮事件。

感谢各位的阅读!关于“如何基于JavaScript实现评论框展开和隐藏功能”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


标题名称:如何基于JavaScript实现评论框展开和隐藏功能-创新互联
文章分享:http://cdkjz.cn/article/ghgde.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220