#4782 closed defect (bug) (fixed)
"Read More" link doesn't fire when another AJAX action is fired first
Reported by: | Lwangaman | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.9 | Priority: | normal |
Severity: | normal | Version: | 1.7 |
Component: | Templates | Keywords: | has-patch |
Cc: | don, burakali |
Description
buddypress's "global.js" script makes use of jquery's deprecated $.live() method. The $.live() method is no longer valid as of jQuery 1.9, it has now been substituted by the $.on() method, which can be attached to the "document" element itself thus having the same effect as the $.live()" method.
Therefore must substitute for example:
$('.activity-read-more a').live('click',function(event){...});
with:
$(document).on('click','.activity-read-more a',function(event){...});
Idem for all similar instances of $.live().
Change History (10)
#2
@
12 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Already fixed; but thank you very much for reporting the issue.
#3
@
11 years ago
In Buddypress 1.8.1, this issue still continues. The necessary change proposed above is not implemented in the global.js or buddypress.js. Please check.
#5
@
11 years ago
- Resolution duplicate deleted
- Status changed from closed to reopened
- Version changed from 1.7 to 1.8.1
#6
@
11 years ago
- Component changed from Core to Theme
- Keywords reporter-feedback added
- Milestone set to Awaiting Review
- Severity changed from blocker to normal
- Type changed from task to defect (bug)
burakali - In BP 1.8.1, there isn't any reference to .live() or .browser() in buddypress.js / global.js:
- http://buddypress.trac.wordpress.org/browser/tags/1.8.1/bp-templates/bp-legacy/js/buddypress.js
- http://buddypress.trac.wordpress.org/browser/tags/1.8.1/bp-themes/bp-default/_inc/global.js
Can you provide any further details?
#7
@
11 years ago
As stated in the description of this ticket, when the 'activity-read-more' live('click;) call was corrected with on('click)... the targeted class stayed ".activity-read-more a" which is inside the dynamic area. It should be something like 'div.activity' or 'document'. See below:
jq('div.activity').on('click','.activity-read-more a',function(event){...}); --as sbrajesh stated above or
jq('document').on('click','.activity-read-more a',function(event){...});
The problem at the moment is when you change a tab or load more activity(which loads new content through ajaxcall), read-more link which is part of activity that is loaded dynamically doesnt fire the ajax call anymore and doesnt slide open. It redirects to the single activity page instead...
#8
@
11 years ago
- Keywords has-patch added; reporter-feedback removed
- Milestone changed from Awaiting Review to 1.9
- Summary changed from jQuery 1.9 has deprecated the methods "$.live()" and "$.browser()" to "Read More" link doesn't fire when another AJAX action is fired first
- Version changed from 1.8.1 to 1.7
Thanks for the additional steps to duplicate, burakali. Bug reproduced.
this has been addressed in a previous ticket for BuddyPress 1.7 branch.
Please have a look at this #4714
Though, there may exist a bug for activity-read-more in the current code, as activity items are dynamically loaded for pagination and read more link will not work(the on should not be bound on dynamically inserted element).
A better idea will be to bind it to activity div like
jq('div.activity').on('click','.activity-read-more a',function(event){...});