Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to make Google Adsense ad clickable? WordPress

I am the developer of Leaflet Maps Marker Pro ([[LINK href=""]][[/LINK]]) which also allows adding Google Adsense ads to your maps. I already asked a question here on how to make Google Adsense ads clickable: [[LINK href=""]][[/LINK]]

The solution was to add the class leaflet-control to the maps (submitted by Dbranes).

I know discovered, that this only works for marker maps and not for layer maps.
See a demo here (ad in first map is clickable, ad in second map not):

[[LINK href=""]][[/LINK]]

I just canĀ“t figure out why the solution to add leaflet-control to the ad doesnt work on the second map & am thankful for any hints!


Answers (1)


Giri answers:

Your second map has this code

<svg class=" leaflet-zoom-animated" width="1246" height="960" viewBox="-304 -240 1246 960" style="-webkit-transform: translate3d(-304px, -240px, 0);"></svg>

width="1246" height="960" occupies everything.

I have no idea what that code does in your map.. But if you wanna make that ad clickable you should either reduce the height and width or hide that using display:none property.

I mean like this

#lmm_2ea588b6 .leaflet-zoom-animated {
display:none !important;

Where #lmm_2ea588b6 is your second map id.

Giri comments:

Actually your map id is not static. So you may have to wrap that map in a div with unique id.

I mean like this

<div id="second-map">
<p>your map code goes here</p>

Now you can target your map like this

#second-map .leaflet-zoom-animated {
display:none !important;

Robert Harm comments:

Thx for your answer - it helps a bit although I could solve it properly as hiding the svg overlay completely is moreba hack than a solution as it is needed for other parts of the map...