WordPress.org

Ready to get started?Download WordPress

Forums

I Recommend This
[resolved] Any tips on making in work ok with Jetpack infinity scroll? (4 posts)

  1. akis
    Member
    Posted 12 months ago #

    I have tried with the following but I'm probably doing something wrong.

    $(document).on( 'post-load', function(){
    dot_irecommendthis.js code
    });

    Thanks.

    http://wordpress.org/plugins/i-recommend-this/

  2. akis
    Member
    Posted 12 months ago #

    Solved.

    jQuery(document).ready(function($){
        $(document).on( 'ready post-load', function () {
            $('.dot-irecommendthis').unbind('click').bind("click",function() {
            		var link = $(this);
            		if(link.hasClass('active')) return false;
    
            		var id = $(this).attr('id'),
            			suffix = link.find('.dot-irecommendthis-suffix').text();
    
            		$.post(dot_irecommendthis.ajaxurl, { action:'dot-irecommendthis', recommend_id:id, suffix:suffix }, function(data){
            			link.html(data).addClass('active').attr('title','You already recommended this');
            		});
    
            		return false;
        	});
        });
    });
  3. Harish Chouhan
    Member
    Plugin Author

    Posted 11 months ago #

    Thanks @akis.

    Can you share your details with me so I will test this and give you credit when I update the plugin with your code.

  4. akis
    Member
    Posted 11 months ago #

    I basically used the events detailed here http://jetpack.me/support/infinite-scroll/#javascript-events, replaced live with bind because live is deprecated in the last version of jQuery and added unbind due to multiple triggers on each click (some conflict with infinte scroll).

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.