# Ionic 4 Hide Toolbar on scroll

**URL:** <https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189>\
**Category:** ionic-v3\
**Created:** [October 10, 2018, 4:35pm UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189 "2018-10-10T16:35:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitairos](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amitairos](https://forum.ionicframework.com/u/amitairos)\
**Post date:** [October 10, 2018, 4:35pm UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189/1 "2018-10-10T16:35:29Z")

</div>

I’m trying to implement a directive to hide the Toolbar while scrolling. I tried using this tutorial: [https://medium.com/@gregor.srdic/ionic3-hidding-header-on-footer-on-content-scroll-15ab95b05dc5](https://medium.com/@gregor.srdic/ionic3-hidding-header-on-footer-on-content-scroll-15ab95b05dc5)

This worked with Ionic 3, but doesn’t work with Ionic 4.  
On the following code I get the error:

```auto
private adjustElementOnScroll(ev) {
    if (ev) {
        console.log(ev);
        ev.domWrite(() => {
            let scrollTop: number = ev.scrollTop > 0 ? ev.scrollTop : 0;
            let scrolldiff: number = scrollTop - this.lastScrollPosition;
            this.lastScrollPosition = scrollTop;
            let newValue = this.lastValue + scrolldiff;
            newValue = Math.max(0, Math.min(newValue, this.config.maxValue));
            this.renderer.setStyle(this.element.nativeElement, this.config.cssProperty, `-${newValue}px`);
            this.lastValue = newValue;
        });
    }
}

```

Error:

```auto
ev.domWrite is not a function

```

I checked, and ev in Ionic 4 is a `CustomEvent` , not a `ScrollEvent` .

Any suggestions?

---

<div class="post-metadata">

**Author:** ![amitairos](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amitairos](https://forum.ionicframework.com/u/amitairos)\
**Post date:** [October 17, 2018, 5:33am UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189/2 "2018-10-17T05:33:10Z")

</div>

Anyone? I’m stuck with this…

---

<div class="post-metadata">

**Author:** ![MohammadT](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@MohammadT](https://forum.ionicframework.com/u/MohammadT)\
**Post date:** [January 21, 2019, 4:33pm UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189/3 "2019-01-21T16:33:33Z")

</div>

i am too have problems implement  
this directive if any one can help with any solution for that  
any solution that work for hiding header while scrolling

---

<div class="post-metadata">

**Author:** ![amitairos](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amitairos](https://forum.ionicframework.com/u/amitairos)\
**Post date:** [January 22, 2019, 9:05am UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189/4 "2019-01-22T09:05:00Z")

</div>

Hi.  
I asked the question here:  
[Ionic 4 Hide Toolbar on scroll](https://stackoverflow.com/questions/52744930/ionic-4-hide-toolbar-on-scroll/)  
Report which solution works for you in the latest Ionic 4 release

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:13pm UTC](https://forum.ionicframework.com/t/ionic-4-hide-toolbar-on-scroll/144189/5 "2021-07-19T21:13:32Z")

</div>

Closed on July 19, 2021, 9:13pm UTC


