bouton lire la suite

This commit is contained in:
armansansd 2021-08-29 09:56:31 +02:00
parent cc33fe42d9
commit 4bc0d1353b
2 changed files with 34 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -220,10 +220,38 @@ $(function(){
if($(".page-node-type-programme").length > 0 || $(".page-node-type-projet").length > 0 || $(".page-node-type-theme").length > 0){ 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(){ $('.views-element-container header').click(function(){
$(this).parent().find(".views-row").fadeToggle(); $(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>" let elem = "<div class='main_logo'></div>"
$('#projets-block_2').prepend(elem); $('#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(){ $(".more").on("click", function(){
$(".body").toggleClass("body_open"); $(".body").toggleClass("body_open");
if($('.body_open').length > 0){ if($('.body_open').length > 0){
$(this).empty().html("Fermer") $(this).empty().html("Fermer")