Skip to content
Advertisement

Angular /Javascript- How can I shrink Sticky header on scroll functionality?

In Angular application I am trying to shrink header component of Sticky header when user scrolls down. Currently sticky header works fine.

What changes do I need to make to display lower half of header with no text when user scroll down?

Actual component

enter image description here

Expected Output when user scrolls down – Make Text disappear and display header as sticky showing lower 75% of component enter image description here

This is what I have tried so far which makes whole component sticky when user scroll down

html

JavaScript

.scss

JavaScript

.ts

JavaScript

Advertisement

Answer

For container to actually stick to the ceiling of the page we need to give negative top value.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement