فهرست منبع

Fix click action on article

Before, when the user clicks on an article header one, it expands. When it clicks a second time, it collapses.
When it clicks a third time it stays collapsed instead of expand.
Now it toggles the article between expanded and collapsed state.
Alexis Degrugillier 12 سال پیش
والد
کامیت
7e0566b0a1
1فایلهای تغییر یافته به همراه2 افزوده شده و 5 حذف شده
  1. 2 5
      p/scripts/main.js

+ 2 - 5
p/scripts/main.js

@@ -207,14 +207,10 @@ function mark_favorite(active) {
 }
 
 function toggleContent(new_active, old_active) {
-	old_active.removeClass("active");
-
 	if (new_active.length === 0) {
 		return;
 	}
 
-	old_active.removeClass("current");
-
 	if (does_lazyload) {
 		new_active.find('img[data-original], iframe[data-original]').each(function () {
 			this.setAttribute('src', this.getAttribute('data-original'));
@@ -226,9 +222,10 @@ function toggleContent(new_active, old_active) {
 		if (isCollapsed) {
 			new_active.addClass("active");
 		}
+		old_active.removeClass("active current");
 		new_active.addClass("current");
 	} else {
-		new_active.toggleClass("current");
+		new_active.toggleClass('active');
 	}
 
 	var box_to_move = "html,body",