hello deras
i want to add align or justify for below code , the code hides null CMS inside box1 and shows only filled content , but after hiding null or blank CMS content i want to justify or align the visible
$w.onReady(() => {
$w(“#dynamicDataset”).onReady(() => {
const item = $w(“#dynamicDataset”).getCurrentItem();
console.log(“Current Item:”, item); // Log the current item
// Define an array of field names and corresponding image IDs
const fieldImagePairs = [
{ field: "phoneNumber", imageId: "#image501" },
{ field: "phone2", imageId: "#image502" },
{ field: "whatsApp", imageId: "#image503" },
{ field: "viber", imageId: "#image504" },
{ field: "map", imageId: "#image505" },
{ field: "faceBook", imageId: "#image506" },
{ field: "instagram", imageId: "#image507" },
{ field: "snapchat", imageId: "#image508" },
{ field: "tiktok", imageId: "#image509" },
{ field: "website", imageId: "#image510" }
]; // Correct closing here
// Loop through the array and set visibility of images based on field values
fieldImagePairs.forEach(pair => {
const fieldValue = item[pair.field]; // Get the value of the field in the current item
const image = $w(pair.imageId); // Get the image element by ID
if (fieldValue) {
image.show(); // Show image if there is a value in the field
} else {
image.hide(); // Hide image if the field value is empty or not present
}
});
});
});