12345678910111213141516171819202122232425262728293031323334353637383940 |
- // images collées en bas de page
- if (debug) console.log('start bottomImgs');
- (function() {
- let bottomImgs = document.querySelectorAll('.bottomimg, .tripleimgs_bottom, .tripleimgs2_bottom');
- for (let bottomImg of bottomImgs) {
- let pageBottom = bottomImg.closest('.pagedjs_area').getBoundingClientRect().bottom;
- let imgBottomPos = pageBottom - bottomImg.lastElementChild.getBoundingClientRect().bottom;
- bottomImg.style.transform = `translateY(${imgBottomPos}px)`;
- }
- // pour les images en bas dans les pages avec du texte
- let bottomVignettes = document.querySelectorAll('.imgsmall_bottom');
- for (let bottomVignette of bottomVignettes) {
- let pageBottom = bottomVignette.closest('.pagedjs_area').getBoundingClientRect().bottom;
- let vignetteSize = bottomVignette.getBoundingClientRect().height;
- if (bottomVignette.previousElementSibling) {
- let textBottom = bottomVignette.previousElementSibling.getBoundingClientRect().bottom;
- if (bottomVignette.previousElementSibling.classList.contains('labeur') ||
- bottomVignette.previousElementSibling.classList.contains('citation') ||
- bottomVignette.previousElementSibling.classList.contains('free') ||
- bottomVignette.previousElementSibling.classList.contains('temps')) {
- bottomVignette.style.marginTop = `${(pageBottom - textBottom) - vignetteSize}px`;
- }
- bottomVignette.style.transform = 'translateY(12px)';
- } else {
- let vignetteBottom = bottomVignette.getBoundingClientRect().bottom;
- bottomVignette.style.transform = `translateY(${pageBottom - vignetteBottom}px)`;
- }
- }
- })();
- if (debug) console.log('end bottomImgs');
|