[OpenLayers-Users] Apply CSS style to popup content
Kris Geusebroek
kgeusebroek at xebia.com
Thu May 28 09:55:54 EDT 2009
Hi Maxime,
The framedCloud popup uses the olFramedCloudPopupContent by default. So
you could just change that style in you css.
Otherwise you can create subclass of framedCloud like I did:
OpenLayers.Popup.MyFramedCloudPopupClass =
OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'contentDisplayClass': ' myOwnStyleForFramedCloudPopupContent'
});
function showInfo(evt) {
var lonLat = map.getLonLatFromPixel(evt.xy);
var infoResponse = evt.text;
var oPopup = new
OpenLayers.Popup.MyFramedCloudPopupClass('chicken',lonLat,new
OpenLayers.Size(100,100),infoResponse, null, true,null);
map.addPopup(oPopup);
}
And create a style called .myOwnStyleForFramedCloudPopupContent in your
css
Cheers Kris
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Maxime Phaneuf
Sent: Thursday, May 28, 2009 3:38 PM
To: users at openlayers.org
Subject: Re: [OpenLayers-Users] Apply CSS style to popup content
Hi Kris, thanks for your quick input.
Unfortunetaly, I looked for examples on how to use subclass because I
don't
really know how that works.
Here's what I did so far:
function showInfo(evt) {
var lonLat = map.getLonLatFromPixel(evt.xy);
var infoResponse = evt.text;
var oPopup = new
OpenLayers.Popup.FramedCloud('chicken',lonLat,new
OpenLayers.Size(100,100),infoResponse, null, true,null);
map.addPopup(oPopup);
}
Do I need to create a FramedCloud like you did before or after oPopup?
Also,
could I just use 'contentDisplayStyle' when I create oPopup?
Cheers, Maxime
Kris Geusebroek wrote:
>
> Hi Maxime
>
> AutoSizeAnchored = OpenLayers.Class(OpenLayers.Popup.Anchored, {
> 'autoSize': true,
> 'contentDisplayClass': 'olPopupLabelContent'
> });
>
> Creates a subclass of popupAnchored with a different content style.
> In your css you can specify the specifics of this style
>
> Cheers Kris
>
> -----Original Message-----
> From: users-bounces at openlayers.org
[mailto:users-bounces at openlayers.org]
> On Behalf Of Maxime Phaneuf
> Sent: Wednesday, May 27, 2009 9:11 PM
> To: users at openlayers.org
> Subject: [OpenLayers-Users] Apply CSS style to popup content
>
>
> Hi guys,
>
> Based on this example:
> http://openlayers.org/dev/examples/getfeatureinfo-control.html, I
> succeeded
> in querying a WMS layer with WMSGetFeatureInfo. The only difference is
> that
> I make a pop-up appear instead of a <div> on the page.
>
> The only problem I encounter is that I want to apply CSS style to the
> content of that pop-up, but I can't seem to do it. Does any of you
know
> how
> this can be done?
>
> Thank you
> Maxime Phaneuf
>
> --
> View this message in context:
>
http://n2.nabble.com/Apply-CSS-style-to-popup-content-tp2983101p2983101.
> html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context:
http://n2.nabble.com/Apply-CSS-style-to-popup-content-tp2983101p2987696.
html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list