Last active
April 10, 2018 22:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only requirement is to replace 'yith_infs_added_elem' event by whatever is the event to add items after a scroll is made