filter / expand bug fix

main
zvevqx 9 months ago
parent b886831ecd
commit bc3317704e
  1. 82
      static/main.js
  2. 8
      static/style.css

@ -1,62 +1,13 @@
$(document).ready(function(){ $(document).ready(function(){
$(".alist li").click(function(){ //$(".alist li").click(function(){
console.log("lolololol"); //console.log("lolololol");
var ctnt = $(this).find('.content-wrapper')[0] //var ctnt = $(this).find('.content-wrapper')
$(ctnt).toggleClass("open") //$(ctnt).toggleClass("open")
});
var $limit = 45;
// $("#articles ul li a span").each(function(){
// if ($(this).text().length > $limit){
// var cut = $(this).text().substring(0, $limit) + " ...";
// $(this).html(cut);
// }
// });
// wimg = $(".img_container").width();
// console.log(wimg);
// $(".img_container").css("height",wimg);
//
// $(window).resize(function(){
// wimg = $(".img_container").width();
// console.log(wimg);
// $(".img_container").css("height",wimg);
// })
//
$('#gal .img_container img').click(function(){
// $(" #gal .img_container").removeClass("fullImg");
$(this).parent().toggleClass("fullImg");
});
function sortArticles(columnClass) {
const $list = $('.alist');
const $listItems = $list.children('li');
// Sort the list items based on the text of the specified column
$listItems.sort(function(a, b) {
const aText = $(a).find('.' + columnClass).text().trim().toLowerCase();
const bText = $(b).find('.' + columnClass).text().trim().toLowerCase();
return aText.localeCompare(bText);
});
// Detach and reappend sorted items to maintain DOM structure
$list.empty().append($listItems);
}
// Add click event to legend spans
//$('.legend li span').on('click', function() {
//// Get the class corresponding to the clicked span
//const columnClass = $(this).text().toLowerCase().replace(/\s+/g, '');
//// If the column exists in the article items, sort by that column
//if ($('.alist li').first().find('.' + columnClass).length > 0) {
//sortArticles(columnClass);
//}
//}); //});
const sortState = {};
const sortState = {};
// Function to sort articles // Function to sort articles
function sortArticles(columnClass) { function sortArticles(columnClass) {
@ -113,6 +64,27 @@ $(document).ready(function(){
}); });
$(".alist").on('click', 'li ', function(e) {
// Prevent this event from interfering with sorting or default link behavior
e.preventDefault();
console.log("lolololol");
var ctnt = $(this).find('.content-wrapper');
if (ctnt.length === 0) {
ctnt = $(this).closest('li').find('.content-wrapper');
}
$(ctnt).toggleClass("open");
});
//$(".alist").on('click', 'li', function(e) {
//// Prevent this event from interfering with sorting
//if ($(e.target).closest('.legend').length === 0) {
//console.log("lolololol");
//var ctnt = $(this).find('.content-wrapper');
//$(ctnt).toggleClass("open");
//}
//});
}) })

@ -250,6 +250,7 @@ a:hover{
#articles ul.alist li .content-wrapper{ #articles ul.alist li .content-wrapper{
height:0; height:0;
max-height: 0;
overflow: hidden; overflow: hidden;
color : #000; color : #000;
background: #fff background: #fff
@ -263,13 +264,12 @@ a:hover{
.open{ .open{
height:auto !important; height:auto !important;
transition: all 0.3s ease; max-height:2000px !important;
margin-top:10px; margin-top:10px;
transition: max-height 0.25s ease-in;
} }
.content-wrapper{ .content-wrapper{
margin:auto ; margin:auto ;
font-size:1em!important; font-size:1em!important;

Loading…
Cancel
Save