-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
Completely new coding to me. Plz help #92
Comments
If you're not a <link href="https://unpkg.com/leaflet-geosearch@latest/assets/css/leaflet.css" rel="stylesheet" />
<script src="https://unpkg.com/leaflet-geosearch@latest/dist/bundle.min.js"></script> // instead of import {} from 'leaflet-geosearch', use the `window` global
var GeoSearchControl = window.GeoSearch.GeoSearchControl;
var OpenStreetMapProvider = window.GeoSearch.OpenStreetMapProvider;
// remaining is the same as in the docs, accept for the var instead of const declarations
var provider = new OpenStreetMapProvider();
var searchControl = new GeoSearchControl({
provider: provider,
});
var map = new L.Map('map');
map.addControl(searchControl); |
I'm not sure; it's working in the demo: http://smeijer.github.io/leaflet-geosearch/#google Can you check what's going wrong here?
|
yes, i included style.css |
The library doesn't use images. What browser are you using? Do you have a demo somewhere online that I can take a look? |
I have uploaded demo in given site.............. im using Mozilla Firefox |
That demo doesn't include the required stylesheet. It seems that you've copied the styles from the docs folder. <link href="https://unpkg.com/leaflet-geosearch@latest/assets/css/leaflet.css" rel="stylesheet" /> Loading this stylesheet into your head, immediately fixes the problem. I do hover see a problem for when you decide to use the control on the right side of the map. Because the searchbar will run off screen. For now, please add the correct stylesheet, and position the search control to the left side of the screen; or override the styles to fix this problem. I'll open a issue for the alignment. |
To fix the styling issue when aligning on the right; add this to your general styles: .leaflet-right .leaflet-control-geosearch form {
right: 28px;
left: initial;
border-radius: 4px 0 0 4px;
border-left: inherit;
border-right: none;
} It will be added to the next version of |
Can you please show a demo somewhere again? |
my host is currently down, so i would like to send you my code in .txt format I have simply changed style var searchControl = new GeoSearchControl({ sorry for inconvenience |
I have deployed a small update to fix the "bar" issue, where the bar was displayed behind the tiles. Please check this demo: http://codepen.io/smeijer/pen/GrQrMY |
Big Thanks........... for your timely and accurate solutions......Now I think that this issue can be closed if you wish |
No problem. Please let me know if you find any other difficulties. |
I solved it with |
i fixed by import css from node_modules |
This really helped me after struggling for 2 days to get it running... I don't have npm access either. The above solution should really replace the one currently here: https://smeijer.github.io/leaflet-geosearch/#using-a-cdn as that one says to still use import when using CDN and that is what I have tried 2 days without luck ;-) |
I kept getting a `TypeError i is undefined` with the umd version of the script from unpkg. I finally found issue smeijer#92 and someone suggested using a different version on unpkg. I tried that and my error was resolved so I made that change in the docs.
I have been using traditional <script> to load geoSearch but it is not working now. I have installed it using npm and don't know what to do. The example in docs is unknown to me. Please helpppppppp. When using <script> and reffering to bundle, css and openstreetmap provider from node module i get following error
jQuery.Deferred exception: L.GeoSearch is undefined
ReferenceError: exports is not defined[Learn More] openStreetMapProvider.js
Im not much used to coding but the <script> used to work then....not now
The text was updated successfully, but these errors were encountered: