Is your $.fn.almComplete function in a document.ready and is your site JS loaded after ALM?
Cheers,
Hey dcooney-
Yup! I initially hadn’t done this, but realized I needed to and moved it down. My app.js file where this resides is the last thing on my page.
Despite it being the last thing that callback function isn’t being hit, which I can’t figure out for the life of me.
Is it possible to share a link?
Hey Dcooney (and anyone else)-
You can see the staging site here: http://tvrev.actsofphilosophie.com/
The load more button is somewhat hidden now, but you can pull it up using the Inspector and just assign the z-index to 9999 and move top to like 2000px or 1500px
I have it so it just fires on a click event and just does one post for easy testing. I’ve shrunk my JS for that portion to:
$.fn.almComplete = function(alm){
console.log("callback posts")
}
I can’t get the button to show… Can you fix this?
Hey!
Just made the button show up. Let me know if this helps and thanks in advance for your help.
Ok thanks. I’m not sure why this isn’t firing.
All I can think of is there might be something up with your repeater template but im really not sure.
Gah! Very strange. The weird thing is the posts are loading when clicked. So it’s working just the JS isn’t firing. Any other plugins accomplish something similar (Load more posts on click)? I’ll try to take a look under the hood tomorrow too.
Im not sure. if there is another plugin it definitely isn’t as good as mine π
I just tested the callback on 4 different installs and it’s working on all.
I believe you! Just to confirm, you are doing it on click events IE:
<?php echo do_shortcode( '[ajax_load_more post_type="post" offset="10" pause="true" scroll="false" posts_per_page="1" button_label="More Posts"]' ); ?>
Any special settings? I’m using: more-posts-container
Container type: Div
Custom container class
Dynamic Content: False
AJAX Security: False
Top of page: True
Disable CSS: True
No, not on click.
It’s triggered after the data has been returned from the ajax call.
I get that, but in the plugin there is one option to have the posts loaded on scroll and another on click.
I’m noticing some pretty weird stuff with my asset loading that may be contributing to this, I have a hunch that is the issue. Thanks for your help! I will keep you posted and let me know if anything comes ot mind
I’m seeing this same behavior and noticed that I’m assigning a function to $.fn.almComplete but the big caveat is that when you get to line 795 window.jQuery === $ is false. It’s looking at a different jQuery object… This might have to do with a no-conflict mode, or maybe the jQuery-migrate script…
Line 795 being:
// ALM Complete
if ($.isFunction($.fn.almComplete)) {
if(alm.images_loaded === 'true'){
alm.el.almWaitForImages().done(function(){
$.fn.almComplete(alm);
});
}else{
$.fn.almComplete(alm);
}
}