Removing Title on Popup InfoTemplate for Some Popups

1345
2
05-17-2017 05:36 PM
HenryKo2
Occasional Contributor

I have different type of Popup / InfoTemplate in my map. For certain type of popups, I want to remove the title completely. In other words, I can do something like "if popup info is for feature type A, then remove title; else keep title.".

My InfoTemplate are created with

new InfoTemplate(.....)

I have used CSS to remove the title bar, like below, but this removes title for ALL popups.

.InfoWindowWidget .title { display: none; }

I am using Javascript API 3.13.

Thanks.

0 Kudos
2 Replies
HenryKo2
Occasional Contributor

I should also add that I want to remove the entire title bar, not just the title words.

0 Kudos
FC_Basson
MVP Regular Contributor

If you have a set method of determining the popup "class", e,g. only features from a certain layer is returned, you can still do it in CSS:

.InfoWindowWidget .classA .title { display: none; }

To set the additional class of the popup:

var myIW = document.getElementsByClassName('InfoWindowWidget')[0];
myIW.className += " classA";‍‍

And to remove the additional class again:

var myIW = document.getElementsByClassName('InfoWindowWidget')[0];
myIW.className = "InfoWindowWidget";‍‍‍‍
0 Kudos