I have two jquery on the site. One helps the category to expand and collapse to reveal subcategory (jquery.js). Another jquery help to load the next post and display as the infinite scroll. When scrolling to next post, the URL changes to the new post's URL (jquery-2.1.4.min.js).
If we use both the function, one won't work. For, e.g., if we don't use the (jquery-2.1.4.min.js), the next post will load, but the URL won't change, and if we use the (jquery-2.1.4.min.js), the category won't be collapsable anymore.
I have attached a screenshot which will help you understand the problem.
The "down" icon in the category is displayed when it is working but when the function is not working it is gone. The "loading" that you can see in after the post is fetching the new post. When the category is working the URL of the next post won't be changed. If 2.1.4 is loaded, then the URL changes for the next post, but the category won't be collapsable anymore, and if I only load jquery.js, category will work, but the URL won't change anymore
I have tried using this code in functions.php but this makes matter even worse because of both of the function won't work.
add_action( 'wp_enqueue_scripts', 'replace_scroll' );
function replace_scroll(){
// Remove the Default JavaScript
wp_dequeue_script( 'jquery' );
wp_deregister_script( 'jquery' );
// Add your own script
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/jquery-2.1.4.min.js');
}
I need help in fixing this issue.