filter / expand bug fix

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

@ -1,60 +1,11 @@
$(document).ready(function(){
$(".alist li").click(function(){
console.log("lolololol");
var ctnt = $(this).find('.content-wrapper')[0]
$(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);
// }
//$(".alist li").click(function(){
//console.log("lolololol");
//var ctnt = $(this).find('.content-wrapper')
//$(ctnt).toggleClass("open")
//});
// 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 = {};
@ -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{
height:0;
max-height: 0;
overflow: hidden;
color : #000;
background: #fff
@ -263,13 +264,12 @@ a:hover{
.open{
height:auto !important;
transition: all 0.3s ease;
max-height:2000px !important;
margin-top:10px;
transition: max-height 0.25s ease-in;
}
.content-wrapper{
margin:auto ;
font-size:1em!important;

Loading…
Cancel
Save