Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pablo-sg-pacheco
Last active April 10, 2018 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablo-sg-pacheco/070d45491e92a81be5bdb4d49c84f9e2 to your computer and use it in GitHub Desktop.
Save pablo-sg-pacheco/070d45491e92a81be5bdb4d49c84f9e2 to your computer and use it in GitHub Desktop.
Make the plugin Wish list for WooCommerce compatible with Yith Infinite scrolling
/**
* Makes the plugin Wish list for WooCommerce compatible with Yith Infinite scrolling
*/
add_action('wp_footer',function(){
?>
<script>
jQuery(document).on('yith_infs_added_elem',function(){
jQuery('.alg-wc-wl-btn').addClass('ajax-loading');
var alg_wc_wl_show = function(){
jQuery('.alg-wc-wl-btn.ajax-loading').removeClass('ajax-loading');
}
var alg_wc_wl_position = function(){
if (typeof alg_wc_wl_thumb_btn_positioner === 'undefined' || jQuery.isEmptyObject(alg_wc_wl_thumb_btn_positioner)) {
jQuery('body').on('alg_wc_wl_thumb_btn_positioner', function (e) {
alg_wc_wl_thumb_btn_positioner = e.obj;
alg_wc_wl_thumb_btn_positioner.init();
});
} else {
alg_wc_wl_thumb_btn_positioner.init();
}
setTimeout(alg_wc_wl_show, 200);
};
setTimeout(alg_wc_wl_position, 500);
});
</script>
<?php
});
@pablo-sg-pacheco
Copy link
Author

The only requirement is to replace 'yith_infs_added_elem' event by whatever is the event to add items after a scroll is made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment