Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider "className" option to Popup #6299

Closed
stevage opened this issue Mar 8, 2018 · 3 comments
Closed

Consider "className" option to Popup #6299

stevage opened this issue Mar 8, 2018 · 3 comments

Comments

@stevage
Copy link
Contributor

stevage commented Mar 8, 2018

Currently all popups created using Popup are created with this structure:

<div class="mapboxgl-popup mapboxgl-popup-anchor-bottom" style="....">
<div class="mapboxgl-popup-tip"></div>
<div class="mapboxgl-popup-content">
...user content goes here...
</div>
</div>

Which is fine for styling if you only have one "type" of popup. But sometimes you have hover-over popups, and click popups, which you want to style differently: less padding in the former case.

It's currently very difficult to achieve this, because the outer two layers of <div> are identical in both cases.

Suggestion:

        var popup = new mapboxgl.Popup({
            closeButton: false,
            closeOnClick: false,
            className: "hover-over"
        });

which would lead to:

<div class="mapboxgl-popup mapboxgl-popup-anchor-bottom hover-over" style="....">
...
@jfirebaugh
Copy link
Contributor

In the past we've suggested applying classes to your user content and styling based on that. Is there a case where that doesn't suffice?

@stevage
Copy link
Contributor Author

stevage commented Mar 12, 2018

Yes, as described above:

But sometimes you have hover-over popups, and click popups, which you want to style differently: less padding in the former case.

To spell it out more: currently you can only style the content of the popup individually. Which means every popup will share the same (by default, white, padded, dark outlined) frame.

If you want to have hover-over popups without the padding and frame (which I do), but also have click popups with the padding and frame, you can't do that just by changing the styling of mapboxgl-popup-content.

@Ashot-KR
Copy link
Contributor

Ashot-KR commented Apr 12, 2018

I add this option in PR #6502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants