Okay
  Public Ticket #2346426
AJAX and custom JS
Closed

Comments

  • Rafal started the conversation

    Hello,

    I'm trying to add custom 'before and after' image comparison slider.

    When i'm going directly to the page its working as intendent, but when i'm navigating to this page from main menu using AJAX, it doesn't work.

    I used three different plugin to achieve this, neither is working.

    Link to the page (fourth in main slider).

    I'm looking forward for your help, thanks!

  •  1,823
    Support replied

    Hello Rafal,

    Ajax page transitions will load the target page content container within the original page. Since the target page is not loaded normally the <head> and <body> elements will stay the same.

    If there is javascript initialisation in the head (or the footer) of the page it does not get called in the target page.

    The solution we found is to put all the extra inits (example: WPBakery) in ajaxSuccess event handler as you can see in the child theme we provide in main archive (I attach it here for your convenience, childscript.js file) 

    So you can try adding there the custom JS.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • Rafal replied

    Thank you very much! I managed to solve this issue using that child theme.