Select to view content in your preferred language

How can you change popup design & appearance?

5685
10
07-14-2022 11:11 AM
Labels (1)
ShadSan
Emerging Contributor

Hello, Is it possible to change the size and location of a popup window in web version of Experience Builder? 

10 Replies
JonathanAttard
Occasional Contributor

Sure, here's an example.

// Define an array of field names and their corresponding values
var fields = [
  { name: "Field1", value: $feature.FIELD1 },
  { name: "Field2", value: $feature.FIELD2 },
  { name: "Field3", value: $feature.FIELD3 },
  { name: "Field4", value: $feature.FIELD4 },
  { name: "Field5", value: $feature.FIELD5 }
];

function getLine(name, value) {
  return `<div><strong>${name}: </strong>${value}</div>`;
}

var content = ""
for(var i in fields){
  var field = fields[i]
  content += getLine(field.name, field.value);
}

// Generate the HTML layout dynamically
var layout = `
<div style="color: #333333;">
  <h2 style="color: #555555;">Generic Content</h2>
  ${content}
</div>`;

return { 
  type: 'text', 
  text: layout // This property supports HTML tags 
};