I read the article in this forum. But I don’t really understand.
I want the function below to be deactivated forever when I click some button.
What should I do? Please save me…
Big love bro
import wixWindow from ‘wix-window’ ;
const pageSections = ;
$w . onReady ( function () {
if ( wixWindow . formFactor === “Desktop” ) {
getPageSections ();
initSectionScrollSnap ();
}
});
function getPageSections ( ) {
$w ( ‘Page’ ). children . forEach ( section => {
section . type === ‘$w.Section’ && pageSections . push ( section );
});
}
function initSectionScrollSnap ( ) {
const bgShapes = [
‘section1Background’ ,
‘section2Background’ ,
‘section3Background’ ,
‘section4Background’ ,
‘section5Background’ ,
‘section6Background’ ,
‘section7Background’ ,
‘section8Background’
];
bgShapes . forEach (( container , index ) => {
const bgShape = $w ( # ${ bgShapes [ index ]}
);
bgShape . onViewportEnter ( async () => {
await pageSections [ index ]. scrollTo ();
});
})
}