Skip to content

Re-use JS file with other class options – Amasty_Xsearch

I try to describe my problem in Magento 2.4
After the Amasty_Xsearch update I had to redesign it, but I’m stuck on a problem.

On the result search page, I have a “see more” button that allows me to display more products. This one is the same as on my pagelist, so it will work with the same .js

But in the Amasty_Xsearch page my css class (“products_container: ‘.products.list.items.product-items’,”) is different so my JS does not work anymore. My new class is :

I would like to override this one with the name of the new class only in the Amasty module but I don’t know how to proceed? Can you help me?

This my .js :

define(
    ['jquery'],
    function($) {
        "use strict";
        $.widget('avosdim.progressbar', {
            products_container: '.products.list.items.product-items',
            progress_info: '.progress-info',
            bar: '.progress',

            _create: function() {
                this._updateInfoProgress();
                this._bindEvents();
            },