Browse Source

bouton lire la suite

armansansd 3 years ago
parent
commit
4bc0d1353b
2 changed files with 33 additions and 3 deletions
  1. 0 0
      web/themes/custom/popsu/js/main.js
  2. 33 3
      web/themes/custom/popsu/lib/script.js

File diff suppressed because it is too large
+ 0 - 0
web/themes/custom/popsu/js/main.js


+ 33 - 3
web/themes/custom/popsu/lib/script.js

@@ -220,10 +220,38 @@ $(function(){
 if($(".page-node-type-programme").length > 0 || $(".page-node-type-projet").length > 0 || $(".page-node-type-theme").length > 0){
 	$('.views-element-container header').click(function(){
 		$(this).parent().find(".views-row").fadeToggle();
-	})
-	
-	$(".body").append('<footer><a class="more">Lire la suite</a></footer>');
+	});
 
+	//test hauteur
+	let hb = $(".block-region-second .body").height();
+	let ttp = 0;
+	$(".block-region-second .body p").each(function(){
+		ttp = ttp + $(this).height() ;
+	});
+	if(hb < ttp + 30){
+		$(".block-region-second .body").append('<footer><a class="more">Lire la suite</a></footer>');
+	}
+	//reteste on windows resize 
+	window.addEventListener('resize', function(){
+		
+		let hb = $(".block-region-second .body").height();
+		let ttp = 0;
+		$(".block-region-second .body p").each(function(){
+			ttp = ttp + $(this).height() ;
+		});
+		if(hb < ttp+30){
+			
+			if($(".block-region-second .body footer").length == 0){
+				
+				$(".block-region-second .body").append('<footer><a class="more">Lire la suite</a></footer>');
+			}	
+		}else{
+			if($(".block-region-second .body footer").length > 0){
+				$(".block-region-second .body footer").remove();
+			}		
+		}
+		
+	});
 	let elem = "<div class='main_logo'></div>"
 	$('#projets-block_2').prepend(elem);
 
@@ -236,6 +264,8 @@ if($(".page-node-type-programme").length > 0 || $(".page-node-type-projet").leng
 	});
 
 	$(".more").on("click", function(){
+		
+
 		$(".body").toggleClass("body_open");
 		if($('.body_open').length > 0){
 			$(this).empty().html("Fermer")

Some files were not shown because too many files changed in this diff