FEATURE Alternates articles pictures
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5ca8edabd4
commit
afb23bdd9d
|
|
@ -21,4 +21,14 @@
|
||||||
@apply text-base;
|
@apply text-base;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
.wp-block-image {
|
||||||
|
@apply p-3 border border-primary border-solid;
|
||||||
|
|
||||||
|
&.rotate-left {
|
||||||
|
rotate: -0.6deg;
|
||||||
|
}
|
||||||
|
&.rotate-right {
|
||||||
|
rotate: 0.6deg;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
resources/js/singles/alternate-pictures.ts
Normal file
11
resources/js/singles/alternate-pictures.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
export default function alternatePictures() {
|
||||||
|
const images = document.querySelectorAll('.page--single-articles .wp-block-image');
|
||||||
|
|
||||||
|
images.forEach((img, index) => {
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
img.classList.add('rotate-right');
|
||||||
|
} else {
|
||||||
|
img.classList.add('rotate-left');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ import handleArticleReader from './reader.ts';
|
||||||
import { handleArticleToolbar } from './article-toolbar.ts';
|
import { handleArticleToolbar } from './article-toolbar.ts';
|
||||||
import { handleRevueToolbar } from './revue-toolbar.ts';
|
import { handleRevueToolbar } from './revue-toolbar.ts';
|
||||||
import handleSearchRevue from './search-revue.ts';
|
import handleSearchRevue from './search-revue.ts';
|
||||||
|
import alternatePictures from './alternate-pictures.ts';
|
||||||
export default function singles(): void {
|
export default function singles(): void {
|
||||||
const isSingleRevue: HTMLElement | null = document.querySelector('.page--single-revue');
|
const isSingleRevue: HTMLElement | null = document.querySelector('.page--single-revue');
|
||||||
const isSingleArticle: HTMLElement | null = document.querySelector('.page--single-articles');
|
const isSingleArticle: HTMLElement | null = document.querySelector('.page--single-articles');
|
||||||
|
|
@ -22,4 +23,8 @@ export default function singles(): void {
|
||||||
handleShareButton();
|
handleShareButton();
|
||||||
handleArticleReader();
|
handleArticleReader();
|
||||||
handleSearchRevue();
|
handleSearchRevue();
|
||||||
|
|
||||||
|
if (isSingleArticle) {
|
||||||
|
alternatePictures();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user