Tagged: infinite-scroll conflict
November 25, 2014 at 1:04 pm #15411
When using Infinite Scroll and MapPress, the MapPress map does not load on any “pages” other than the first page. I think I somehow need to re-initialize MapPress each time the Infinite Scroll pagination is clicked. Is this possible? Is there function to reinitialize in a callback?November 25, 2014 at 1:04 pm #15412
I should clarify that Infinite Scroll does offer a callback for just this purpose, and I have used it successfully with some other scripts (a slider, a lightbox…). I just don’t know how to reinitialize MapPress since it’s a plugin and not a simple script that I loaded myself.
Also, this doesn’t happen with all plugins. For example, I have a Facebook plugin that uses a shortcode to display my facebook feed. And that loads fine on all “pages” of the infinite scroll.
Thank you!November 25, 2014 at 2:01 pm #15415ChrisKeymaster
I’m sorry, but I don’t think it will be possible to display the maps inside the infinite scroll area.
Because the Google Maps API is large, MapPress only outputs its scripts and map data (POIs, styles, etc.) when a map shortcode is present in the current post. They are output in the blog footer, during the wp_footer() function call.
My guess is the scroller is fetching the post content for each page, but not the footer. That makes sense for the scroller – but in this case the footer would normally contain the map scripts and data. Without them, it won’t be possible to just call an ‘initialize’ function and draw the map.December 4, 2014 at 9:37 am #15434
Thank you. Is it possible to force wp_footer() in the Infinite Scroll callback so that the map script will load each time the “Load More Posts” button is clicked? Are there problems associated with doing that? (Aside from it being annoying to HAVE to do something like that?)December 4, 2014 at 10:39 am #15439ChrisKeymaster
No, even if it was possible, calling wp_footer() won’t work.
MapPress wasn’t designed to display the maps in anything but a blog page, so I don’t think there’s a solution using the current version.
However – I’d like to take a look to see if the plugin can be modified to work in the scroller. Could you send me a link your blog, and tell me which infinite scroll plugin you’re using?
Please use the contact form so I can email you directly. I’ll post any updates here.
- You must be logged in to reply to this topic.