我有一個通知面板,顯示最後的通知。但通知的內容取決於通知推送的內容。所以這可以從很短的信息到更長的信息。短消息是完全顯示,但較長的一次,無法正確顯示現在我寫這樣更好看:根據裏面的內容設置p元素的高度
而這正是我說的是HTML:
<div data-role="content" class="ui-content">
<ul data-role="listview">
<li id="notification-block">
<img class="notification_bell" src="img/icons/alert.png">
<div class="notification-wrapper">
<h2 class="notification-header"></h2>
<p class="notification-message"></p>
<p class="read-more">
<a href="#all" style="text-decoration: none" data-transition="slide">
Meer <span class="fa fa-angle-right carot"></span>
</a>
</p>
</div>
</li>
</ul>
</div>
這是怎麼我設置動態通知消息的內容:
$(".notification-header").append(title);
$(".notification-message").append(message).first("p");
當您在小提琴就會有溢出隱藏帶省略號看到。但我想要的是,它改變了高度,並打破了一線閱讀。
這裏被重新FIDDLE
你確定這個任務需要涉及JS?難道你不能直接使用[這些方法](http://vanseodesign.com/css/vertical-centering/)中的'notification-block'中間的'notification-wrapper'來取消'margin: 60px 10px 5px 10px;'? – pttsky