Initialize MJS for some input
If you want to initialize any Findify MJS widget (recommendation, search, smart collection, autocomplete) for the input you can use the following code
var element = $("#root")[0]; //HTML element
var type = "search"; //widget type
window.findifyCreateFeature(element, { type: type });
Here an reference code that can help you understand how to implement this on the example of recommendations:
$("action_source").click(function() {
var element = $("#root-element")[0]; //root - is a HTML element
var type = "recommendations"; //type of widget
var slot = "cart-findify-rec-1"; //id of selected widget type
var title = "You Custom Tilte"; // title of future widget
window.findifyCreateFeature(element, {
type: type,
slot: slot,
title: title
});
});
Updated almost 7 years ago