gpt4 book ai didi

javascript - 在弹出窗口中显示更多文本

转载 作者:太空宇宙 更新时间:2023-11-04 09:29:35 24 4
gpt4 key购买 nike

$('.SeeMore').click(function() {
$('.PopUp').fadeIn(10).html('.text')
});
.text
{
width:200px;
height:200px;
border:1px solid #000;
background-color:rgba(230,230,230,1);
overflow:hidden;
position:relative;
}
.SeeMore
{
position:absolute;
bottom:0;
right:0;
display:none;
}

.PopUp
{
width:300px;
height:300px;
background-color:white;
border:1px solid #000;
position:absolute;
top:0;
left:0;
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

<div class="SeeMore">Show more
</div>




</div>

<div class="PopUp">
</div>

您好,我有两个问题,首先,如果文本大于 div 大小,如何在右下角显示文本“显示更多”,然后单击它并在弹出窗口中显示所有文本?

最佳答案

可以用JS统计文本中有多少个字符,如果超过了div的数量,则显示“显示更多”按钮。然后,您可以使用 window.open 打开一个弹出窗口。参见 this fiddle

关于javascript - 在弹出窗口中显示更多文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40874477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com