Home Forums WoodMart support forum Problem with accordion and unfold widget

Problem with accordion and unfold widget

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #268298

    Rachid
    Participant

    Hi there!

    I have a problem with the accordion and unfold widget in the shop category pages! I have hired a developer to find the problem and I would like a solution from your side! lOgins in private section

    here is the video of the issue is here:

    loom.com/share/f773e6693fa6442e843a5e9d9049b090

    and here is the answer of the Unfold developer:

    Hi , Thanks for the video. Indeed the link was not showing at all. Ok so as I explained before, this iss what happens: The unfold widget requires a script that is loaded when the page containing the widget is loaded in the browser. Since you don\’t have any widgets in the browser when the page is loaded, the script file (called unfold.js) is not present. When you click on a product category link, the loading circle appears. That means the page is loading content using Ajax (a request is made in the background and the content below is replaced with the new content when the request receives a response from the server). Since the unfold script is not present when you first visit the shop page, any unfold widget present inside the content added via Ajax will not work. Moreover, even if the script would be present, it would need to be triggered on the unfold widget to work. Now, our widget cannot setup itself and we cannot add the script in this scenario. All this is up to the code from the theme that loads the new content. So THAT code should be the one that loads the necessary scripts found on the new content and trigger the appropriate events. To better understand, I\’ve added an Accordion widget to your template that contains the unfold widget. The Accordion is an Elementor widget and it requires its own javascript code and trigger to work, exactly the same as the unfold widget. You can see it underneath the unfold widget. It behaves exactly the same, and the explanation is the same. Now, if you go to a category via the links, these widgets won\’t work. But if you refresh the page, both widgets will work because the scripts are loaded when you visit a category page directly and not load it via ajax (in which case the script files and triggers are missing). I hope this makes sense.

    #268363

    Artem Temos
    Keymaster

    Hello,

    Yes, everything is correct. If the content is loaded dynamically with AJAX, the JS should be initialized manually and not only on page load. There are two ways to solve this problem:

    1. Plugin’s developer can load JS files globally. And init it on our special JS trigger like this

    $(document).on('pjax:complete',function() {
        // plugin init scripts.
    });

    Sorry, but we are not able to do this in our theme’s core.

    2. Disable our AJAX shop functionality and then it will work as expected by plugin’s developer.

    There are no other ways to solve this and we can’t do this in our theme’s scope.

    Kind Regards

Viewing 2 posts - 1 through 2 (of 2 total)