locomotivemtl / locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.
https://locomotivemtl.github.io/locomotive-scroll
MIT License
7.55k stars 1.11k forks source link

Disable locomotive scroll on one page #463

Open FMoriella opened 1 year ago

FMoriella commented 1 year ago

Hello everybody, I need to disable scroll locomotives on a specific page, but I can't find a solution. I have a page with filters and when I select one the page it scrolls badly and with a lot of white space. Some solutions?

Akrasnovskis commented 1 year ago

You need just enqueue script to the rest of the pages and exclude them from the specific page for example if ( is_page( array( 'your-page' ) ) ) { // leave empty } else { wp_register_script('locomotive-script', 'https://cdn.jsdelivr.net/npm/locomotive-scroll@3.5.4/dist/locomotive-scroll.min.js', false, '3.5.4', true); wp_enqueue_script('locomotive-script'); }

Is this something that you want to achieve? or?

agl320 commented 8 months ago

@Akrasnovskis I have a single page application, how would I disable scripts or locomotive scroll in this case when a condition is true?