From 6a65dce6d90d7db37f4054b6b293787ac2015b01 Mon Sep 17 00:00:00 2001 From: Ekaterina Kondareva <> Date: Mon, 9 Nov 2020 19:33:39 +0200 Subject: [PATCH] hero content position --- src/components/hy-hero/hy-hero.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/hy-hero/hy-hero.tsx b/src/components/hy-hero/hy-hero.tsx index 3969d470..1018e239 100644 --- a/src/components/hy-hero/hy-hero.tsx +++ b/src/components/hy-hero/hy-hero.tsx @@ -42,8 +42,14 @@ export class HyHero { if (!contentWrapper) return; if (document.body.scrollWidth >= 1441) { - const marginLeft = parseInt(window.getComputedStyle(contentWrapper).getPropertyValue('margin-left')) + 32; - contentDiv.style.left = marginLeft !== 32 ? `${marginLeft}px` : '32px'; + const marginLeft = parseInt(window.getComputedStyle(contentWrapper).getPropertyValue('margin-left')); + if (marginLeft > 32) { + contentDiv.style.left = `${marginLeft}px`; + } else if (marginLeft > 0) { + contentDiv.style.left = '32px'; + } else if (marginLeft == 0) { + contentDiv.style.left = '0px'; + } } else { contentDiv.style.left = window.getComputedStyle(contentWrapper).getPropertyValue('padding-left'); } -- GitLab