js a script doesn't work after loading of the filter

Forums › Forums › Search & Filter Pro › js a script doesn't work after loading of the filter

Tagged: ,

Viewing 6 posts – 1 through 6 (of 6 total)
  • Anonymous
    #6841

    Hello. Help to repair. If I use “filter category” (sidebar).

    Example.
    1. Open the page http://test.pandoragroup.ru/category-2/
    2. Press the cart (post 2 product). Works.
    3. Now choose “category 2” in the filter. Also repeat point 2. Doesn’t work.

    What shall I do?

    Anonymous
    #6842

    I found this code

    $(".searchandfilter").on("sf:ajaxstart",function(){
    console.log("ajax start");
    });
    
    $(".searchandfilter").on("sf:ajaxfinish",function(){
    console.log("ajax complete");
    //so load your lightbox or JS scripts here again
    });

    Explain please as to integrate this code into mine of the site.

    Anonymous
    #6843

    Script which needs to be connected

    
    <link rel='stylesheet' id='fancybox-css'  href='http://test.pandoragroup.ru/wp-content/themes/Boutique/epanel/page_templates/js/fancybox/jquery.fancybox-1.3.4.css?ver=1.3.4' type='text/css' media='screen' />
    
    Ross Moderator
    #7102

    Hey Rozhnov, it looks like you managed to get it working 🙂

    Anonymous
    #25520

    Hi Ross. Why does not work the script?

    <script type="text/javascript">
    $(document).on("sf:ajaxstart", ".searchandfilter", function(){console.log("ajax start");});
    $(document).on("sf:ajaxfinish", ".searchandfilter", function(){console.log("ajax complete"); document.write("<h1>hi all!</h1>");});
    $(document).on("sf:init", ".searchandfilter", function(){console.log("S&F JS initialised");});
    </script>

    Page for example, http://www.mega-pools.ru/?sfid=41738&_sft_category=category-1

    Ross Moderator
    #25522

    Hey there – sorry for the absence on email – as you probably guessed I have been super busy with this release.

    I’ve tested the above code various times now in different setups and all seemed to be working ok.

    The only thing I notice on the above that you may be doing wrong is you are not wrapping your jQuery in ready events or a function.

    Try changing above to:

    <script type="text/javascript">
    (function ( $ ) {
    	
    	"use strict";
    
    	$(function () {
    		$(document).on("sf:ajaxstart", ".searchandfilter", function(){console.log("ajax start");});
    		$(document).on("sf:ajaxfinish", ".searchandfilter", function(){console.log("ajax complete"); document.write("<h1>hi all!</h1>");});
    		$(document).on("sf:init", ".searchandfilter", function(){console.log("S&F JS initialised");});
    	});
    
    }(jQuery));
    </script>

    Let me know

    Thanks

Viewing 6 posts – 1 through 6 (of 6 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.