Guest User

buddypress activity stream - Read More and Load More

a guest
Jul 29th, 2014
291
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Activity "Read More" links
  2. jq('div.activity').on('click', '.activity-read-more a', function(event) {
  3. var target = jq(event.target);
  4. var link_id = target.parent().attr('id').split('-');
  5. var a_id = link_id[3];
  6. var type = link_id[0]; /* activity or acomment */
  7.  
  8. var inner_class = type == 'acomment' ? 'acomment-content' : 'activity-inner';
  9. var a_inner = jq('li#' + type + '-' + a_id + ' .' + inner_class + ':first' );
  10. jq(target).addClass('loading');
  11.  
  12. jq.post( ajaxurl, {
  13. action: 'get_single_activity_content',
  14. 'activity_id': a_id
  15. },
  16. function(response) {
  17. jq(a_inner).slideUp(300).html(response).slideDown(300).trigger('post-load');
  18. });
  19.  
  20. return false;
  21. });
RAW Paste Data