• Resolved Harry

    (@xaric)


    Hey there, I installed the plugin but I can’t seem to be able to make it work as the normal scrolling seems to persist.

    I’m using OceanWP with Elementor and the menu I’d like to enable smooth scrolling for is the one under the profile picture.

    Please note that I’ve already enabled “Prevent other scripts from handling plugin’s links”

    Thanks a lot in advance for all the help!

    Harry

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    It seems that the following theme script prevents “Page scroll to id” from doing its thing:

    ...themes/oceanwp/assets/js/theme.vanilla.min.js

    First, try going to plugin settings and add the following in “Prevent other scripts from handling plugin’s links selector(s)” option field:

    a[href*='#']:not([href='#'])

    Save changes and test.

    If this doesn’t work, check to see if there’s a setting or option in your theme to disable its in-page anchor scrolling. The link below seems to show where such option is:

    https://www.onsitewp.com/oceanwp-breaks-navigation-menu-same-page-anchor-links/

    Let me know

    Thread Starter Harry

    (@xaric)

    Hi Malihu, thanks a lot for the prompt reply.

    I added the code in the field as per your suggestion but nothing really changed.

    I then turned off OceanWP’s scroll effect but unfortunately, nothing again.

    However, I noticed that the smooth scroll seems to be working only if I type in the URL along with the CSS selector at the end (e.g. https://teacherondemand.siterubix.com/teacher-profile-2/#availability).

    Any suggestions?

    Harry

    Plugin Author malihu

    (@malihu)

    Typing the URL in browser’s address bar works because “Page scroll to id” is not prevented by the other script(s) that handle the menu links.

    The problem is that there are 2 scripts (one from the theme and another one from the jet engine plugin that handle your menu links (i.e. scroll the page to the target).

    Add again the value I posted in “Prevent other scripts from handling plugin’s links selector(s)” option and make sure OceanWP scroll effect is turned off. Then let me know so I can check the page because the only solution would be to edit the js files manually.

    Thread Starter Harry

    (@xaric)

    Hello Malihu, the code is in place and the scroll effect is off.

    Please check and let me know how to proceed.

    Thanks a lot again for your help and attention.

    Plugin Author malihu

    (@malihu)

    You’re welcome 🙂

    I checked the page again and unless there are other settings in your theme and the Jet menu, the only way to solve this is, is by manually editing the js files.

    I don’t know if you can or want to do this but if you do, this is what you need:

    Backup the 2 files below before modifying them in case of a typo error!

    1.Edit this file:

    ...themes/oceanwp/assets/js/theme.vanilla.min.js

    Change the text:

    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="#"]), .local a[href*="#"]:not([href="#"]), a.menu-link[href*="#"]:not([href="#"]), a.sidr-class-menu-link[href*="#"]:not([href="#"])

    Make sure you’re replacing the exact text shown above!

    Save the file.

    2.Edit this file:

    ...plugins/jet-menu/assets/public/js/legacy/jet-menu-public-scripts.js

    Change the text:

    this.$instance.on( 'click', '.jet-menu-item > a', { instance: this }, clickHandler );

    with:

    this.$instance.on( 'click', '.jet-menu-item > a:not(.__mPS2id)', { instance: this }, clickHandler );

    Again, make sure you’re replacing the exact text shown above and save the file.

    Test and let me know if it worked (it should).

    In case it doesn’t work, I’ll provide a slightly different code to test.

    To find text in the files you normally use the Ctrl+F in Windows/Linux and Command+F in OSX on your keyboard. In the first file (theme.vanilla.min.js) the js code is minified, so it’s difficult to read but if you use the keyboard shortcut and replace the exact text, you should be fine.

    Thread Starter Harry

    (@xaric)

    Hello again Malihu, I edited both of the files with the codes you suggested but unfortunately, it still doesn’t seem to work.

    Could you please take another look?

    Plugin Author malihu

    (@malihu)

    OK. Change the text of theme.vanilla.min.js to:

    a[href*="#"]:not([href="#"]):not([data-ps2id-api]), a.local[href*="#"]:not([href="#"]), .local a[href*="#"]:not([href="#"]), a.menu-link[href*="#"]:not([href="#"]), a.sidr-class-menu-link[href*="#"]:not([href="#"])

    Leave the other file (jet-menu-public-scripts.js) as it is.

    Thread Starter Harry

    (@xaric)

    Hi Malihu, that did it! Smooth scrolling works perfectly now!

    Is there any chance that you could help me fix the menu highlights as well?

    All the best.

    Plugin Author malihu

    (@malihu)

    Sure, let me know what you need.

    Thread Starter Harry

    (@xaric)

    Hi Malihu, sorry for the delay. I’m going to make the menu sticky so I need the following 2 things:

    – Highlight the menu anchor when clicked by a user
    – When a user scrolls down the page, automatically highlight the corresponding section even if not clicked

    Here’s an example of exactly what I’m after achieving -> https://takelessons.com/profile/deanna-h5?service=piano

    Is something like this possible using your plugin (excluding the sticky function of course).

    Harry

    Plugin Author malihu

    (@malihu)

    Yes it is 😉

    You can find the related plugin options here and here and a guide here.

    I can provide you with the actual CSS to use for your page layout:

    For example the following will make your teacher menu sticky and highlight each section link while scrolling the page:

    /* sticky menu */
    .elementor-element.elementor-element-bccc53b.elementor-widget.elementor-widget-jet-mega-menu{
        position: sticky;
        top: 0;
        background-color: white;
        z-index: 3;
        margin: 20px 0 30px 0;
    }
    
    .elementor-909 .elementor-element.elementor-element-bccc53b .jet-menu .jet-menu-item .top-level-link{
        padding-top: 10px;
    }
    
    .elementor-909 .elementor-element.elementor-element-bccc53b > .elementor-widget-container{
        margin-top: 0;
        margin-bottom: 0;
    }
    
    /* links highlighting */
    .elementor-909 .elementor-element.elementor-element-bccc53b .jet-menu .jet-menu-item > .top-level-link.mPS2id-highlight-first, 
    .elementor-909 .elementor-element.elementor-element-bccc53b .jet-menu .jet-menu-item:first-child > .top-level-link.mPS2id-highlight:not(.mPS2id-highlight-first){
        color: #ff7333;
        border-style: solid;
        border-width: 0px 0px 3px 0px;
        border-color: #ff7333;
    }

    Hope this helps

    Thread Starter Harry

    (@xaric)

    Hi Malihu, thanks a ton for providing all the code. I haven’t had a chance to check it out yet so I’m going to mark this ticket as resolved for your own convenience and will open a new one if I happen to need any additional help.

    Your willingness and ability to offer support are both out of this world. Keep it up!

    All the best and stay safe,

    Harry

    Plugin Author malihu

    (@malihu)

    No problem 🙂

    Let me know if/when you need more help.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Can’t make the plugin work’ is closed to new replies.