Hey guys, I have this task I faced. Can you help me please? Thank you.
If you know another way this task can be resolved - let know as well.
Task:
I need to create a search that works on one page, and works with 4 CMSs on the page.
Information.
I have a page that has 4 CMS sections on it.
Each section has the same CMS with different filters (CMS settings: preview items where 1)name = N, 2)where name = M, 3)where name = X, 4)where name = Y).
I created a search with this tutorial:
It works, but it works for the first section only, despite that the CMS which is used is the same for all 4 sections.
Question: how do I make the search work on all 3 other sections as well?
Here are the code and settings that are being used:
CMS item class name:
pdf-card (is applied to every item in every CMS section)
class name for the text in the CMS item:
name
All CMS names(wrapper,list,item) are the same on all sections
the search element embed code editor:
Inside head tag:
.results {display:block;} .noresults {display:none;} .w-slider-dot { background: #D9D9D9; height:0.8rem; width:0.8rem; } .w-slider-dot.w-active { background: #DD8500; height:0.8rem; width:0.8rem; }Before body tag: (with opening script and closing script. If I add it here the code is not previewed)
$(“.page-search”).on(“keyup”, function() {
var v = $(this).val();
$(“.results”).removeClass(“results”);
$(“.noresults”).removeClass(“noresults”);
$(“.pdf-card”).each(function() {
if (v != “” && $(this).text().search(new RegExp(v, ‘gi’)) != -1) {
$(this).addClass(“results”);
} else if (v != “” && $(this).text().search(v) != 1) {
$(this).addClass(“noresults”);
}
});
});
Thank you!
Here is my site Read-Only: LINK
(how to share your site Read-Only link)