I-Code habe folgende und ich versuche, die zweite Ziffer standardmäßig zu verstecken und es zeigt, wenn blauer Kreis angeklickt wird und div erweitert wird, dass Absatz sollte hieranzeigen/ausblenden Absatz basierend auf div Höhe
Anzeige ist der Code
$(document).ready(function() {
// Store inner height in a data property:
$(".added-msg-inner").removeClass("added-msg-inner").each(function() {
$(this).data({
innerHeight: $(this).height()
});
}).addClass('added-msg-inner');
$(".added-msg-inner > p:nth-child(2)").hide();
$(".downarrow").click(function() {
// Get specific divView and innerHeight related to this down arrow
var $divView = $(this).siblings(".added-msg-inner");
var innerHeight = $divView.data("innerHeight");
$divView.animate({
height: $divView.height() == 95 ? innerHeight : "95px"
}, 500);
$('i', this).attr("class",
$divView.height() == 95 ? "fa fa-angle-up" :
"fa fa-angle-down");
return false;
var $minHeight = 95;
if ($(this).height() > $minHeight) {
$(".added-msg-inner > p:nth-child(2)").show();
}
});
});
.added-msg2 {
padding: 3% 1%;
float: left;
width: 100%;
box-sizing: border-box;
font-size: 14px;
color: #333333;
position: relative;
background-color: #e0e0e0;
}
.added-msg-inner {
float: left;
width: 100%;
height: 95px;
overflow: hidden;
}
.downarrow {
position: absolute;
right: 15px;
bottom: -12px;
z-index: 1;
width: 30px;
height: 30px;
line-height: 30px;
font-size: 18px;
color: #fff;
background-color: #003478;
border-radius: 50%;
text-align: center;
font-weight: bold;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="added-msg2">
<div class="added-msg-inner">
<p>Message added by agent user on<br> Sat, Jun 24th, 2017 (5:03AM)</p>
<p>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</p>
<p><i class="fa fa-paperclip" aria-hidden="true"></i> ABCFileName.pdf</p>
</div>
<div class="downarrow"><i class="fa fa-angle-down" aria-hidden="true"></i></div>
</div>
danke für die Antwort, Sie haben es sehr einfach! +1 für kompakte Lösung –
Froh, dass es hilfreich war :) – sigil