Mega Menu with Hover Effects Continuation

Continuation of this thread: Mega Menu with Hover Effects

Thanks @ruenel,
That helped, however, to be able to trigger the slide change on hover I had to add some JavaScript. You can see it in action here: https://melioravivere.com/working-home/

I’m sure there’s a better way (if you can share it, I’d really appreciate it), but what I did was the following:

1- Copied all the code from cs-sliders…js to the header’s custom JS.
2- Near the end I added the following code, copied from data-x-slide-goto near the end, where I changed the line [we(e, "click", r=>{ for [we(e, "mouseover", r=>{

Code
le("[data-x-slide-goto-hover]", (e,n)=>{
    let s = Ye(n) - 1
      , {unsubscribe: a, getState: o, dispatch: c} = Se.subscribe(e, "slider")
      , t = ["effects", {
        key: "current",
        condition: [s + 1, "=="],
        enter: "effect",
        exit: "effect"
    }, "slider"];
    return cn.update(e, r=>({
        ...r,
        effectRivet: t
    })),
    [we(e, "mouseover", r=>{
        c(g=>({
            ...g,
            navigateTo: s
        }))
    }
    , {
        passive: !0
    }), a, $e([[e, ...t]])]
}
);

Now, for this to work I copied everything in the cs-sliders js file, which I know is not the most elegant, efficient, or future-proof way to do this. However, my knowledge of JS is minimal, and I’m not sure how to make that part work without the rest of the code above it.
Is there a way to add that piece of code to my header JS and make it place nice with the rest of the cs-sliders JS?
Or. even better, as I’m sure others could use this functionality, could this (or something similar) be added to the official Theme?

Thanks, Oriol

Hello Oriol,

We do not recommend modifying the JS script. It may not work later on or gets overwritten with the updates. Please also understand that CUSTOM CODING is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.