Plugin Author
malihu
(@malihu)
Hi,
The file has changed indeed. The file you want to edit is:
/wp-content/themes/oceanwp/assets/js/scroll-effect.min.js
and you need to replace:
'a[href*="#"]:not([href="#"]), a.local[href*="#"]:not([href="#"]), .local a[href*="#"]:not([href="#"]), a.menu-link[href*="#"]:not([href="#"]), a.sidr-class-menu-link[href*="#"]:not([href="#"])'
with:
'a[href*="#"]:not([href="#"]):not(.__mPS2id), a.local[href*="#"]:not([href="#"]):not(.__mPS2id), .local a[href*="#"]:not([href="#"]):not(.__mPS2id), a.menu-link[href*="#"]:not([href="#"]):not(.__mPS2id), a.sidr-class-menu-link[href*="#"]:not([href="#"]):not(.__mPS2id)'
Save the file and test.
Let me know if this does the trick 😉
Hey!
I did the edit, yet i don’t see any changes.
Before and after the change I console logged each elements that the querySelectorAll found in that forEach loop. To me it seems the same amount of menu elements it got. All menu items and all anchor elem hrefs in the content. If it helps any.
I tried to turn off any other distraction, sticky header plugin, etc.
OceanWP’s scroll effect script turned off or on, did no change for me.
PLease note that the OceanWP has the OceanWP Extra plugin turned on, which may have additional logic in its plugin files. (I searched maybe there is a scroll-effect.js too, that overwrites, i didn’t find.). Also tried Ocean Extra turned off., no effect.
Let me know if i can provide more info or access.
Best, Wiktor
Plugin Author
malihu
(@malihu)
No problem. We probably need to change the .__mPS2id
selector we used. We should also better remove the first selector (a[href*="#"]:not([href="#"])
) completely.
So, Change:
'a[href*="#"]:not([href="#"]):not(.__mPS2id), a.local[href*="#"]:not([href="#"]):not(.__mPS2id), .local a[href*="#"]:not([href="#"]):not(.__mPS2id), a.menu-link[href*="#"]:not([href="#"]):not(.__mPS2id), a.sidr-class-menu-link[href*="#"]:not([href="#"]):not(.__mPS2id)'
to:
'a.local[href*="#"]:not([href="#"]):not([data-ps2id-api]), .local a[href*="#"]:not([href="#"]):not([data-ps2id-api]), a.menu-link[href*="#"]:not([href="#"]):not([data-ps2id-api]), a.sidr-class-menu-link[href*="#"]:not([href="#"]):not([data-ps2id-api])'
Save and test
Oh yeah. All came to life again. 😀
Thank you so much. I wish i’d understand the underlying logics more.., i’m greatly inspired to further research your plugin’s logic and learn..
Wiktor
Plugin Author
malihu
(@malihu)
You’re welcome 🙂
The problem was that the oceanwp script (scroll-effect.min.js) handled the menu links and prevented “Page scroll to id” from doing its thing.
The basic logic with the changes we did, is that we’re excluding the links we want (in our case the links in the top menu) from the oceanwp script. We do this by instructing the script that it should not handle links that have the data-ps2id-api
attribute, which is an attribute added by “Page scroll to id” (that’s why we added the :not([data-ps2id-api])
part in each selector).
Thus, the oceanwp script will not handle links with data-ps2id-api
attribute, i.e. links that are (and should be) handled by “Page scroll to id”, meaning that “Page scroll to id” will be able to do its thing, e.g. scroll the page smoothly, apply the offset etc.
Hope this makes sense 🙂