allow blog-box pre-expand-blog click

This commit is contained in:
zhaospei 2023-02-07 18:50:02 +07:00
parent 1e79a53575
commit e0116f9c54

View file

@ -32,15 +32,14 @@
{% block js_media %} {% block js_media %}
<script type="text/javascript"> <script type="text/javascript">
function activateBlogBoxOnClick() { function activateBlogBoxOnClick() {
$('.show-more').on('click', function () { $('.blog-box').on('click', function () {
var $blogbox = $(this).parent().parent(); var $description = $(this).children('.blog-description');
var $description = $blogbox.children('.blog-description');
var max_height = $description.css('max-height'); var max_height = $description.css('max-height');
if (max_height !== 'fit-content') { if (max_height !== 'fit-content') {
$description.css('max-height', 'fit-content'); $description.css('max-height', 'fit-content');
$blogbox.css('cursor', 'auto'); $(this).css('cursor', 'auto');
$blogbox.removeClass('pre-expand-blog'); $(this).removeClass('pre-expand-blog');
$(this).hide(); $(this).children().children('.show-more').hide();
} }
}); });
@ -52,6 +51,7 @@
} }
if ($content > $precontent - 30) { if ($content > $precontent - 30) {
$(this).addClass('pre-expand-blog'); $(this).addClass('pre-expand-blog');
$(this).css('cursor', 'pointer');
} else { } else {
$(this).children().children('.show-more').hide(); $(this).children().children('.show-more').hide();
} }