默认指定列表最大高度,显示【显示全文】按钮,在显示全文前插入遮罩div。
点击显示全文后取消列表高度限制,隐藏【显示全文】按钮和遮罩div。
<div class="notice_box"><div><img src="/img/notice.svg" alt /><p>お知らせ</p></div><div><ul :class="{notice_list:!seeAllNotice}"><li v-for="(notice,index) in noticeList" :key="index" class="notice_item"><p><u>・{{notice.title}}</u></p><p>{{notice.date}}</p></li></ul><div:class="{showAll:true,ulBlend:!seeAllNotice}"@click="showAllNotice"v-show="!seeAllNotice"><u>続きを表示</u></div></div></div>
JS部分
showAllNotice() {this.seeAllNotice = true;},
CSS部分
.notice_list {max-height: 60px;}.ulBlend::before {content: "";position: absolute;width: 92%;height: 20px;margin-top: -24px;left: 13px;background: -webkit-gradient(linear,0 0,0 100%,from(rgba(255, 255, 255, 0.2)),to(rgba(255, 255, 255, 1)));background: -moz-linear-gradient(top,rgba(255, 255, 255, 0.2),rgba(255, 255, 255, 1));background: -o-linear-gradient(top,rgba(255, 255, 255, 0.2),rgba(255, 255, 255, 1));background: linear-gradient(top,rgba(255, 255, 255, 0.2),rgba(255, 255, 255, 1));filter: progid:adient(startColorstr=#0ff, endColorstr=#fff, GradientType=0);}.showAll {text-align: center;height: 30px;line-height: 30px;font-weight: bold;}
本文发布于:2024-02-01 22:16:25,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170679698339779.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |