52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
|
Miscellaneous bits of documentation that don't really fit anywhere else
|
||
|
|
||
|
|
||
|
|
||
|
🍂namespace Global Switches
|
||
|
|
||
|
Global switches are created for rare cases and generally make
|
||
|
Leaflet to not detect a particular browser feature even if it's
|
||
|
there. You need to set the switch as a global variable to true
|
||
|
before including Leaflet on the page, like this:
|
||
|
|
||
|
```html
|
||
|
<script>L_NO_TOUCH = true;</script>
|
||
|
<script src="leaflet.js"></script>
|
||
|
```
|
||
|
|
||
|
| Switch | Description |
|
||
|
| -------------- | ---------------- |
|
||
|
| `L_NO_TOUCH` | Forces Leaflet to not use touch events even if it detects them. |
|
||
|
| `L_DISABLE_3D` | Forces Leaflet to not use hardware-accelerated CSS 3D transforms for positioning (which may cause glitches in some rare environments) even if they're supported. |
|
||
|
|
||
|
|
||
|
🍂namespace noConflict
|
||
|
|
||
|
This method restores the `L` global variable to the original value
|
||
|
it had before Leaflet inclusion, and returns the real Leaflet
|
||
|
namespace so you can put it elsewhere, like this:
|
||
|
|
||
|
```html
|
||
|
<script src='libs/l.js'>
|
||
|
<!-- L points to some other library -->
|
||
|
|
||
|
<script src='leaflet.js'>
|
||
|
<!-- you include Leaflet, it replaces the L variable to Leaflet namespace -->
|
||
|
|
||
|
<script>
|
||
|
var Leaflet = L.noConflict();
|
||
|
// now L points to that other library again, and you can use Leaflet.Map etc.
|
||
|
</script>
|
||
|
```
|
||
|
|
||
|
|
||
|
🍂namespace version
|
||
|
|
||
|
A constant that represents the Leaflet version in use.
|
||
|
|
||
|
```js
|
||
|
L.version; // contains "1.0.0" (or whatever version is currently in use)
|
||
|
```
|
||
|
|
||
|
|