Skip to content
Snippets Groups Projects
Commit 54c95f15 authored by Matthieu Benoist's avatar Matthieu Benoist
Browse files

Fix: displays of CGU pop-in in small screen

Solve some scroll problems in smaller screens
parent 8eed1d65
Branches
Tags
1 merge request!75Fixes for some CGU popin and WS tab problems
<div class="modal cgu-modal" [ngClass]="{'is-active': cguModalIsOpened }">
<div class="modal-background"></div>
<div class="modal-card">
<div class="modal-card" #cguAnchor>
<header class="modal-card-head">
<p class="has-text-weight-bold" i18n="@@cgu.modal.title">Terms of use</p>
<button class="modal-close is-large" aria-label="close" (click)="closeCguModal()"></button>
......@@ -21,4 +21,4 @@
</div>
</footer>
</div>
</div>
\ No newline at end of file
</div>
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, OnInit, Output, ViewChild, ElementRef } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { CookieService } from 'ngx-cookie-service';
......@@ -22,6 +22,7 @@ export class CguModalComponent implements OnInit {
shakeAnimation = false;
@Output() cguAccepted = new EventEmitter();
@ViewChild('cguAnchor', {static:true}) cguAnchor: ElementRef;
constructor(
private _editorialisationService: EditorialisationService,
......@@ -77,9 +78,15 @@ export class CguModalComponent implements OnInit {
}
modalBodyScrolled(event) {
const target = event.target || event.srcElement;
if (Math.ceil(target.scrollTop) + target.offsetHeight >= target.scrollHeight) {
this.isCguScrolledEntirely = true;
}
else {
this.cguAnchor.nativeElement.scrollIntoView({ behavior: "smooth", block: "start", inline:'nearest' });
const y = this.cguAnchor.nativeElement.getBoundingClientRect().top + window.pageYOffset -80;
window.scrollTo({top: y, behavior: 'smooth'});
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment