diff --git a/resources/js/alternate-pictures.ts b/resources/js/alternate-pictures.ts new file mode 100644 index 0000000..aaf555c --- /dev/null +++ b/resources/js/alternate-pictures.ts @@ -0,0 +1,11 @@ +export default function alternatePictures() { + const images = document.querySelectorAll('.wp-block-image.is-style-framed'); + + images.forEach((img, index) => { + if (index % 2 === 0) { + img.classList.add('rotate-left'); + } else { + img.classList.add('rotate-right'); + } + }); +} diff --git a/resources/js/app.ts b/resources/js/app.ts index 626d652..9a5a69c 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -2,9 +2,11 @@ import menuInit from './header'; import initFooterShapes from './footer'; import handleScrollTop from './utilities/scroll-top'; import handleInsidePageScrolling from './page-scrolling'; +import alternatePictures from './alternate-pictures'; window.addEventListener('load', function () { menuInit(); initFooterShapes(); handleScrollTop(); handleInsidePageScrolling(); + alternatePictures(); });