-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FeatureRequest: "Load more" Ajax via jQuery ajaxComplete #126
Comments
Hi @wassereimer86 , this issue is related to your plugin/theme which provides the "load more" functionality which is not part of WordPress Core. EnlighterJS needs to be initialized which is normally done on page load (domready event). by loading additional content to the page you have to trigger this hook manually to initialize the newly added content. Enlighter has build-in support for Jetpack InfiniteScroll - the code is available here which can be used as skeleton/example to work with your plugin best regards, Andi |
I was not able to get it fixed. But thank you for the information. |
which kind of plugin/theme did you use to provide the "read more" feature ? |
they are using the standard jQuery jQuery(document).on('ajaxComplete', function(){
console.log("complete")
}); just use the handler code to replace the one on line 57 |
// scope
jQuery(function(jq){
// enlighterJS available ?
if (typeof EnlighterJS == "undefined" || typeof EnlighterJS_Config == "undefined"){
return;
};
// config objects
var i = Object.clone(EnlighterJS_Config);
i.renderer = 'Inline';
i.grouping = false;
var b = Object.clone(EnlighterJS_Config);
b.renderer = 'Block';
// helper to fetch all new elements
var getNewElements = (function(s){
// get all selected elements
var e = document.getElements(s) || [];
// filter new elements
e = e.filter(function(el){
// only visible elements are "new"
return (el.getStyle('display') != 'none');
});
return e;
});
// re-initialize
var _init = (function(){
if (i.selector.inline){
EnlighterJS.Util.Helper(getNewElements(i.selector.inline), i);
}
if (b.selector.block){
EnlighterJS.Util.Helper(getNewElements(i.selector.block), b);
}
});
// content update event
jq(document).on('ajaxComplete', function(){
_init.apply(window);
});
}); will be added to the next beta of v3.9 |
Great! Thank you very much! For now i replaced the existing plugin and activated it. :) Working fine. :) |
Hello,
i´m new here from the dying Crayon Plugin. It was still working but i wanted to take the step and change to a new plugin befor i´m forced to do it.
So i installed your plugin, set it all up and replaced every Crayon Code with Enlighter. I´m pretty happy with it but i found a little issue. When using a "Load more" Button at the end of the page to load more articles Enlighter doesn´t work with the new loaded content.
Live Example: https://www.randnotizen.org/ - Scroll down to "MEHR BEITRÄGE LADEN" and click on it - From there on Enlighter won't load and show up.
I already tried disabling W3TC but it still doesn´t work.
Would be great if you have a solution for that.
Best regards
The text was updated successfully, but these errors were encountered: