It worked before, now doesn’t…what changed?
Anyway, it’s working for me, so maybe it’s because you’re logged in? I don’t know hard to guess what the problem is.
Thread Starter
vlaaD
(@vlaadnet)
Hi, … sorry … actually the lightbox never worked in the search result page … I discovered this problem yesterday accidentally while testing the plugin search engine … thanks for the follow up … maybe using a different lightbox plugin … we’ll see … thanks again
Thread Starter
vlaaD
(@vlaadnet)
Hello again …
I managed to solve this problem by disabling the option “Activate the AJAX search function” …
Have a nice day and many thanks for this great plugin …
dB.
If you’re OK with showing the results on a page refresh, you’re good. If you want to keep the AJAX on, you may be able to fix that by changing how the lightbox is attaching it’s handler to the images. You’ll need to have some JS skills for this.
If the lightbox doesn’t work after showing a search result while using AJAX, then that means the lightbox handler is attached by statically targeting an element on the page. Using jQuery, you can change how it attaches the handler so that when the search results come in, the handlers will be dynamically attached to the new content. This is done by targeting the wrapper (a div with a class of “pdb-list”) of the search results, then targeting the individual images as a selector…for example:
$('pdb-list').on( 'click', '.pdb-image img', lightbox_handler );
Where “lightbox_handler” is whatever method the lightbox plugin uses to attach its handler.
This works because the $(‘.pdb-list’) element is not changed by the AJAX, only its content, so the attachment is not broken when the AJAX results come in.
Thread Starter
vlaaD
(@vlaadnet)
Thank you very much for the procedure and the explanations…
dB