# I am a novice, seeking to clear a very basic confusion...

**URL:** <https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [January 1, 2022, 2:44pm UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894 "2022-01-01T14:44:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bablifarm](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/bablifarm/32/14510_2.png) [@bablifarm](https://forum.wixstudio.com/u/bablifarm)\
**Post date:** [January 1, 2022, 2:44pm UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894/1 "2022-01-01T14:44:28Z")

</div>

My landing page - www.babli.org - has the following code (blank) in the page-code panel…

$w . onReady ( **function** () {  
//TODO: write your page related code here…  
});

But the ‘onReady’ bit of the code is showing a red underline - with the following message on roll-over →

Property ‘onReady’ does not exist on type ‘(selector: string) =\> any’.

What is the matter here?

Thanks for any guidance, in advance!

---

<div class="post-metadata">

**Author:** ![pekrzyz](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pekrzyz/32/27981_2.png) [@pekrzyz](https://forum.wixstudio.com/u/pekrzyz)\
**Post date:** [January 1, 2022, 3:13pm UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894/2 "2022-01-01T15:13:50Z")

</div>

Ignore the message. Other posters indicated that there is current issues with the editor, that need to be fixed. Issues seem to have started on Dec 31 in the morning. Ignore for now, code should still work if you try it.

---

<div class="post-metadata">

**Author:** ![bablifarm](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/bablifarm/32/14510_2.png) [@bablifarm](https://forum.wixstudio.com/u/bablifarm)\
**Post date:** [January 2, 2022, 8:57am UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894/3 "2022-01-02T08:57:33Z")

</div>

Thanks @Paul Krzyz!

Actually, another similar code, on my master page code panel, is ALSO showing the same error message… and while that code IS working, per se, there is something weird that’s happening to the page when the code runs… so, I thought maybe there’s some basic error involved…

---

<div class="post-metadata">

**Author:** ![pekrzyz](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pekrzyz/32/27981_2.png) [@pekrzyz](https://forum.wixstudio.com/u/pekrzyz)\
**Post date:** [January 2, 2022, 9:03am UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894/4 "2022-01-02T09:03:54Z")

</div>

Try posting the code if you can (use code snippit) feature of forum posting tool to make it look nicer and easier to read and follow.

---

<div class="post-metadata">

**Author:** ![bablifarm](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/bablifarm/32/14510_2.png) [@bablifarm](https://forum.wixstudio.com/u/bablifarm)\
**Post date:** [January 3, 2022, 6:24am UTC](https://forum.wixstudio.com/t/i-am-a-novice-seeking-to-clear-a-very-basic-confusion/10894/5 "2022-01-03T06:24:27Z")

</div>

Hey Paul,

I am posting the code below…

It is a code that is meant to show/hide the header - on scroll up/ down - and it IS working, in general - the only issue is, if the scroll AMOUNT is very small, then the page keeps jumping up and down - and so, the header keeps showing & hiding - even a console log comes up, as “UP”-“DOWN”-“UP”-“DOWN”… even when there’s no actual scroll happening!

If you scroll MORE, in one go, then the code plays out fine!

The code is placed in the masterPage.js.

// START CODE ~ show/hide header on scroll up/down  
**function** show\_Header ( ) {  
$w ( “#header1” ). children . forEach (( item , i ) =\> {  
item . expand ();  
})  
}

**function** hide\_Header ( ) {  
$w ( “#header1” ). children . forEach (( item , i ) =\> {  
item . collapse ();  
})  
}

**import** wixWindow **from** ‘wix-window’ ;

**var** scrollDirection  
**var** scrollPosition = 0  
**var** scrollInterval = 2000 //The lower the scrollInterval, the more precise will be the scroll-position.

$w . onReady (() =\> { setInterval (() =\> show\_scrollPosition (), scrollInterval ); })

**function** show\_scrollPosition ( ) {  
wixWindow . getBoundingRect ()  
. then (( windowSizeInfo ) =\> {  
**let** scrollX = windowSizeInfo . scroll . x ;  
**let** scrollY = windowSizeInfo . scroll . y ;  
console . log ( scrollX , scrollY )  
**if** (( scrollPosition !== windowSizeInfo . scroll . y ) && ( wixWindow . formFactor !== “Mobile” )) {

```
            **if** ( scrollPosition < windowSizeInfo . scroll . y ) { 
                scrollDirection = "DOWN" , console . log ( scrollDirection ), hide_Header (), $w ( '#box47' ). show () 
            } 
            **if** ( scrollPosition > windowSizeInfo . scroll . y ) { 
                scrollDirection = "UP" , console . log ( scrollDirection ), show_Header (), $w ( '#box47' ). hide () 
            } **else if** ( scrollY === 0 ) { 
                show_Header (); 
            } 
            scrollPosition = windowSizeInfo . scroll . y ; 
        } 

    }); 

```

}  
// END CODE ~ show/hide header on scroll up/down

* * *

This same issue had happened once earlier - then, I had created a duplicate for the site and that had _mysteriously_ solved the problem!

It’s NOT solving the problem now…

Thanks in advance!
