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

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!

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.

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…

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.

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!