From 71800f06c9b2e5785fa34f27857c4756ec0e4322 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 20 Jan 2022 00:47:29 +0200 Subject: [PATCH] [new-theme | Library]: section-scroll component changed to another effect. (not finalized) --- .../section-scroll.component.css | 48 ++++++++++++++++--- .../section-scroll.component.ts | 36 ++++++++++---- 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/utils/section-scroll/section-scroll.component.css b/utils/section-scroll/section-scroll.component.css index 79c74613..2dd17209 100644 --- a/utils/section-scroll/section-scroll.component.css +++ b/utils/section-scroll/section-scroll.component.css @@ -1,10 +1,44 @@ -/* hide scrollbar but allow scrolling */ -*[scroll] { - -ms-overflow-style: none; /* for Internet Explorer, Edge */ - scrollbar-width: none; /* for Firefox */ - overflow-y: scroll; +.section { + position: relative; + height: auto; + /*display: flex;*/ } -*[scroll]::-webkit-scrollbar { - display: none; /* for Chrome, Safari, and Opera */ +.section [top] { + /*height: 80vh;*/ + /*border: 1px solid rebeccapurple;*/ +} + +.section [top] { + position: sticky; + top: 0; + z-index: 2; + height: auto; + /*max-height: 80vh;*/ + /*border: 1px solid deeppink;*/ +} + +/*.content {*/ +/* position: relative;*/ +/* height: auto;*/ +/* z-index: 1;*/ +/* border: 1px solid cyan;*/ +/*}*/ + +[left] { + position: sticky; + top: 0; + height: 100vh; + /*border: 1px solid red;*/ +} + +[left] img { + /*position: absolute;*/ + /*top: 50%;*/ + /*left: 50%;*/ + /*transform: translate(-50%, -50%);*/ + position: sticky; + top: 50%; + left: 10%; + /*border: 1px solid greenyellow;*/ } diff --git a/utils/section-scroll/section-scroll.component.ts b/utils/section-scroll/section-scroll.component.ts index 92c57971..fb8ae08d 100644 --- a/utils/section-scroll/section-scroll.component.ts +++ b/utils/section-scroll/section-scroll.component.ts @@ -11,10 +11,21 @@ import {Component, HostListener, Input, OnInit, ViewEncapsulation} from "@angula @Component({ selector: 'section-scroll', template: ` -
- - -
+ + + + + + + + + + +
+ + + +
`, styleUrls: ['section-scroll.component.css'], encapsulation: ViewEncapsulation.None @@ -23,7 +34,9 @@ export class SectionScrollComponent implements OnInit { @Input() public customClass = null; - private fixed: HTMLElement; + @Input() + public childrenCustomClass = null; + private absolute: HTMLCollectionOf; private scroll: HTMLElement; constructor() { @@ -31,23 +44,26 @@ export class SectionScrollComponent implements OnInit { @HostListener('window:resize', ['$event']) onResize(event) { - this.setHeight(); + //this.setHeight(); } ngOnInit() { - this.setHeight(); + //this.setHeight(); } - + setHeight() { if(typeof document !== "undefined") { - this.fixed = document.querySelector('[fixed]'); + // this.absolute = document.querySelector('[absolute]'); + this.absolute = document.getElementsByClassName('absolute'); this.scroll = document.querySelector('[scroll]'); this.scroll.setAttribute('style','max-height: ' + this.height + 'px;'); + } } get height():number { - return this.fixed?this.fixed.offsetHeight:0; + let htmlElement = this.absolute&&this.absolute.length>0?this.absolute[0]:null; + return htmlElement?htmlElement['offsetHeight']:0; } }