ZAKAI LAB
ANIMATION LIBRARY

IDEAS
DESIGN
TECHNOLOGY
PEOPLE

MOTION
FOR A
BRIGHTER WEB

04

Scroll Horizontal Journey

AI flows. Ideas connect.
Scroll
GSAP
Backgrounds

01

זוכר שאמרת לי
שאת אוהבת כתום ו
שלא התאהבת בבחור הנכון,
נכון להיום שיחות בירקון

רקע

02

אפור, אפור הסלע במשלט,
נוגים, נוגים הכוכבים עם ערב
והוא אהב אותך ואת הלכת,
והוא קטף לך פרח משולי הדרך.

03

היום צבעתי תשיער שלי לסגול בהיר
ולקחתי את האוטו לסיבוב בעיר
הייתי באולפן עד 12 בלילה
כי רציתי להטביע את הרעש
לטשטש את התמונות בתוך הראש שלי

04

היום צבעתי תשיער שלי לסגול בהיר
ולקחתי את האוטו לסיבוב בעיר
הייתי באולפן עד 12 בלילה
כי רציתי להטביע את הרעש
לטשטש את התמונות בתוך הראש שלי

ZAKAI.COM - ליאורה זכאי
				
					<script>
window.addEventListener('load', function () {

	/* ========================================
	   LIORA MOTION LIBRARY
	   04 - SCROLL HORIZONTAL JOURNEY
	   ======================================== */

	if (
		typeof gsap === 'undefined' ||
		typeof ScrollTrigger === 'undefined'
	) {
		console.error(
			'Horizontal Journey: GSAP or ScrollTrigger is missing.'
		);

		return;
	}


	gsap.registerPlugin(ScrollTrigger);


	document
		.querySelectorAll('.liora-horizontal-journey')
		.forEach(function (journey) {


			const track =
				journey.querySelector(
					'.liora-horizontal-track'
				);


			const panels =
				track
					? track.querySelectorAll(
						'.liora-horizontal-panel'
					)
					: [];


			const demo =
				journey.closest('.lab-demo');


			if (
				!track ||
				!demo ||
				panels.length < 2
			) {
				return;
			}


			/* ========================================
			   SETTINGS
			======================================== */

			const panelCount =
				panels.length;

			const endHold =
				window.innerHeight * 0.65;


			/* ========================================
			   RESET
			======================================== */

			gsap.set(track, {
				xPercent: 0
			});


			/* ========================================
			   TIMELINE
			======================================== */

			const timeline =
				gsap.timeline({

					scrollTrigger: {

						trigger: demo,

						start: 'top top',

						end: function () {

							const travel =
								window.innerWidth *
								(panelCount - 1);

							return '+=' +
								(travel + endHold);

						},

						pin: demo,

						pinSpacing: true,

						scrub: 1,

						anticipatePin: 1,

						invalidateOnRefresh: true
					}

				});


			/* ========================================
			   HORIZONTAL MOVEMENT
			======================================== */

			timeline.to(track, {

				xPercent:
					-100 *
					(panelCount - 1) /
					panelCount,

				duration: 3,

				ease: 'none'

			});


			/* ========================================
			   HOLD LAST PANEL
			======================================== */

			timeline.to({}, {

				duration: 0.65

			});

		});


	/* ========================================
	   REFRESH
	======================================== */

	requestAnimationFrame(function () {

		ScrollTrigger.refresh();

	});

});
</script>
				
			
				
					/* ========================================
   LIORA MOTION LIBRARY
   04 - SCROLL HORIZONTAL JOURNEY
   ======================================== */


/* SCENE
======================================== */

.liora-horizontal-journey {
	position: relative;

	width: 100%;
	max-width: 100%;

	overflow: hidden;

	direction: ltr;
}


/* TRACK
======================================== */

.liora-horizontal-track {
	position: relative;

	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;

	width: 400% !important;
	max-width: none !important;

	gap: 0 !important;

	direction: ltr !important;

	will-change: transform;
}


/* PANELS
======================================== */

.liora-horizontal-track > .liora-horizontal-panel {
	position: relative;

	flex: 0 0 25% !important;

	width: 25% !important;
	max-width: none !important;

	min-height: 620px;

	box-sizing: border-box;

	/* Hebrew / RTL content */
	direction: rtl;
}


/* MOBILE
======================================== */

@media (max-width: 767px) {

	.liora-horizontal-track >
	.liora-horizontal-panel {

		min-height: 520px;
	}

}


/* REDUCED MOTION
======================================== */

@media (prefers-reduced-motion: reduce) {

	.liora-horizontal-track {
		transform: none !important;
	}
}
				
			
				
					מבנה Elementor
LIVE DEMO
class: lab-demo
│
└── Container
    class: liora-horizontal-journey
    │
    └── Container
        class: liora-horizontal-track
        │
        ├── Container
        │   class: liora-horizontal-panel
        │
        ├── Container
        │   class: liora-horizontal-panel
        │
        ├── Container
        │   class: liora-horizontal-panel
        │
        └── Container
            class: liora-horizontal-panel

ב־liora-horizontal-track:

Direction: Row →
Wrap: No Wrap

התוכן שבתוך כל Panel חופשי לחלוטין. בדמו שלנו השתמשנו במספר גדול, טקסט קצר ותמונה.
				
			

מה אפשר לשנות.. ואיך ⚙️

EXPLORE / LEARN / REUSE / CREATE

.Costomize to fit your vision

גובה ה־Panels

 
min-height: 620px;

ערך גבוה יותר ייצור סצנה גבוהה יותר. בדמו אפשר גם לשלוט ב־padding ישירות דרך Elementor.

Padding של התוכן: מומלץ לעשות ב־Elementor על liora-horizontal-panel, כי זה חלק מהעיצוב ולא ממנוע האנימציה. בדמו שלנו מתאים בערך:

 
Top:    90px
Right:  70px
Bottom: 70px
Left:   70px

מהירות/רגישות התנועה לגלילה

scrub: 1
ערך גדול יותר ייתן לתנועה השהיה ורכות גדולה יותר ביחס לגלילה.

אורך המסע

 
const travel =
	window.innerWidth *
	(panelCount - 1);
 

כרגע כל מעבר בין Panels מקבל בערך רוחב מסך אחד של גלילה.

משך ההמתנה על Panel האחרון

 
const endHold =
	window.innerHeight * 0.65;
 

0.65 נותן ל־Panel האחרון זמן להישאר על המסך לפני שה־pin משתחרר.

אפשר למשל:

 
0.35 = קצר יותר
0.65 = ברירת המחדל שלנו
1.00 = ארוך יותר

כיוון התנועה

ה־Track עצמו נשאר LTR לצורך חישוב תקין של המסע:

 
direction: ltr;
 

אבל תוכן עברי בתוך Panel מוחזר ל־RTL:

 
direction: rtl;
 

זה חשוב במיוחד באתר עברי ולא כדאי למחוק את ההפרדה הזאת.

 מספר ה־Panels

גרסת הדמו בנויה עם 4 Panels. לכן ה־Track מוגדר:

width: 400% !important;

וכל Panel מוגדר:

flex: 0 0 25% !important;
width: 25% !important;

אם משנים את מספר ה־Panels, יש לעדכן את הערכים בהתאם:

2 Panels → Track 200% → Panel 50%
3 Panels → Track 300% → Panel 33.333%
4 Panels → Track 400% → Panel 25%
5 Panels → Track 500% → Panel 20%
6 Panels → Track 600% → Panel 16.666%

הנוסחה היא:

Track Width = מספר ה-Panels × 100%

Panel Width = 100 ÷ מספר ה-Panels

ה־JavaScript כבר סופר את ה־Panels אוטומטית באמצעות:

 
const panelCount =
	panels.length;

לכן כשמוסיפים או מורידים Panels, אין צורך לשנות את מספרם בסקריפט, רק להתאים את שני ערכי הרוחב ב־CSS.

הערה חשובה  🚩  

האנימציה מבוססת על GSAP + ScrollTrigger. יש לוודא ששתי הספריות נטענות באתר לפני קוד ה־JavaScript של האנימציה.

 

<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/ScrollTrigger.min.js"></script>

מתלבט? בוא/י לדבר איתי בווטסאפ?