Comments (3)
Thanks for the suggestion. I'll have to think about this some more. On the one hand, it's great functionality for long lists where you only care about what is in the map view. Sometimes though, it's nice to be able to use the list to navigate the map itself- do a quick search and jump to the location, even if it's not on the map. This is especially true if you trigger geolocation to zoom to the user's location on mobile devices.
from bootleaf.
Hi! Just to say that I'm building an app using BootLeaf and I would use such a feature described by dinResita. But you also have a good point : we don't necessarly always want this behavior. It's depend of the context.
from bootleaf.
This could be accomplished by registering a map moveend
event to check which points are contained in the current map bounds. I'm still thinking through the best way to include this in the template, but in the meantime, see below for the code to implement this.
map.on("moveend", function (e) {
$("#feature-list tbody").empty();
theaters.eachLayer(function (layer) {
if (map.getBounds().contains(layer.getLatLng())) {
$("#feature-list tbody").append('<tr class="feature-row" id="' + L.stamp(layer) + '"><td style="vertical-align: middle;"><img width="16" height="18" src="assets/img/theater.png"></td><td class="feature-name">' + layer.feature.properties.NAME + '</td><td style="vertical-align: middle;"><i class="fa fa-chevron-right pull-right"></i></td></tr>');
}
});
museums.eachLayer(function (layer) {
if (map.getBounds().contains(layer.getLatLng())) {
$("#feature-list tbody").append('<tr class="feature-row" id="' + L.stamp(layer) + '"><td style="vertical-align: middle;"><img width="16" height="18" src="assets/img/museum.png"></td><td class="feature-name">' + layer.feature.properties.NAME + '</td><td style="vertical-align: middle;"><i class="fa fa-chevron-right pull-right"></i></td></tr>');
}
});
featureList = new List("features", {
valueNames: ["feature-name"]
});
featureList.sort("feature-name", {
order: "asc"
});
});
from bootleaf.
Related Issues (20)
- Sidebar slide over map HOT 4
- whats edit? HOT 1
- Geojson Formatting HOT 3
- search dropbox not displaying result content HOT 1
- Geojsons are not displayed in demo HOT 3
- Cannot change startup position HOT 2
- Update to List.js v 1.2
- Update to Leaflet 1.0.3 HOT 1
- Bootleaf & GpPluginLeaflet-src.js HOT 1
- How to customize bootleaf
- Low Performance +10k Markers HOT 1
- Login Tool HOT 1
- The map doesn't load at the opening of the index HOT 2
- Bootleaf and leaflet-realtime.js
- Incompatibility with Leaflet-easyPrint plugin HOT 3
- Tried to load bootleaf with vuejs but not able to render map
- Bootleaf Update to Leaflet 1.3.1
- searchpush for line features HOT 2
- Update to Bootstrap 4.1?
- Coordinate system HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootleaf.