[Resolved] Réinitialise magnific popup after a filtering operation
This thread is resolved. Here is a description of the problem and solution.
Problem:
The user has built a custom light box using a view, but the lightbox does not work after filtering the view.
Solution:
The user has activated AJAX on the view, after the first-page load, any further AJAX calls will not rebuild the lightbox. The lightbox needs to be built when AJAX calls finish. Check this example custom code:
Making a lightbox. It works but after a new filtering operation it doesn't work. It is here hidden link
I read that we need to reinitialize the js. I find this code for search and filter. What is the class for toolset ?
jQuery(window).load(function(){
activatePopup();
// Plugin callback function
jQuery(document).on("sf:ajaxfinish", ".searchandfilter", function(){
activatePopup();
});
function activatePopup() {
jQuery('.popup-link').magnificPopup({
type:'image'
});
}
});
Hello Eric and thank you for contacting the Toolset support.
Toolset does expose some Javascript events after all of its AJAX operations(filtering, pagination, etc.) that you can use to initialize the lightbox. Check this screenshot for the available events hidden link
You are looking for the event that will fire when the results of your filtering/search finishes, check this screenshot hidden link
A sample code would be:
Hi,
Thanks for your answer
I put this lines in Front end events panel and it doesn't work
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function() {
activatePopup();
});
function activatePopup() {
jQuery('.popup-link').magnificPopup({
type:'image'
});
}
});
Thanks for your support
Would you allow me temporary access to check this issue further? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **