Merge pull request #57 from zhaospei/master

allow blog-box pre-expand-blog click
This commit is contained in:
Bùi Tuấn Dũng 2023-02-07 18:50:45 +07:00 committed by GitHub
commit ec893149d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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();
} }