控制定位(Controls positioning)
我有一个控件,我使用谷歌地图v3添加到地图,目前它看起来像这样:
看看右箭头指向侧面的方向?
我目前正在使用此代码添加它:
// Create a div to hold the control. var controlDiv = document.createElement('div'); var controlUI = document.createElement('button'); controlUI.id = "out"; controlUI.innerHTML = "<i class='icon-chevron-right'></i>"; controlDiv.appendChild(controlUI); Maps.map.controls[google.maps.ControlPosition.TOP_LEFT].push(controlDiv);
它有css ......
#out {position:relative;top:5px;right:0;float:right;border:1px #aaa solid;border-left:0;padding:2px 4px;-webkit-border-top-right-radius: 2px;-webkit-border-bottom-right-radius: 2px;-moz-border-radius-topright: 2px;-moz-border-radius-bottomright: 2px;border-top-right-radius: 2px;border-bottom-right-radius: 2px;}
但这个位置显然有点偏。 我如何才能使默认控件向下移动以进行自定义控件?
I have a control which I am adding to the map using google maps v3, currently it looks like this:
See how the right pointing arrow is out to the side?
I am currently adding it using this code:
// Create a div to hold the control. var controlDiv = document.createElement('div'); var controlUI = document.createElement('button'); controlUI.id = "out"; controlUI.innerHTML = "<i class='icon-chevron-right'></i>"; controlDiv.appendChild(controlUI); Maps.map.controls[google.maps.ControlPosition.TOP_LEFT].push(controlDiv);
and it has the css...
#out {position:relative;top:5px;right:0;float:right;border:1px #aaa solid;border-left:0;padding:2px 4px;-webkit-border-top-right-radius: 2px;-webkit-border-bottom-right-radius: 2px;-moz-border-radius-topright: 2px;-moz-border-radius-bottomright: 2px;border-top-right-radius: 2px;border-bottom-right-radius: 2px;}
But the position is obviously a bit off. How can I make it so that the default controls move down in way for the custom control?
原文:https://stackoverflow.com/questions/14514474
最满意答案
您似乎已经将必要的值编码到项目的键中。 鉴于此,您可以使用该键来查找匹配的子项:
var ref = firebase.database().ref('S01/Products'); var query = allProducts.orderByKey().startAt("C09M03S03").endAt("C09M03S04"); query.on("value", function(snapshot) { snapshor.forEach(function(child) { console.log(child.key, child.val()); }); });
You seem to already be encoding the necessary values into the key of the items. Given that, you can use the key to find the matching children:
var ref = firebase.database().ref('S01/Products'); var query = allProducts.orderByKey().startAt("C09M03S03").endAt("C09M03S04"); query.on("value", function(snapshot) { snapshor.forEach(function(child) { console.log(child.key, child.val()); }); });
相关问答
更多-
Firebase复杂查询子句(Firebase complex query clauses)[2022-05-09]
是的,你可以这样做。 这是一个查找没有john投票的节点的示例,它将从问题中的结构返回third_image节点。 let ref = self.myRootRef.childByAppendingPath("votes") ref.queryOrderedByChild("john").queryEqualToValue(nil) .observeEventType(.Value, withBlock: { snapshot in for child in snapshot.chi ... -
Firebase数据库没有SQL的WHERE id IN (1,2,3) 。 在按ID选择的情况下,Firebase检索项目的方式同样快,因为Firebase会对请求进行管道处理 。 你的情况有所不同,因为你没有按ID选择。 很遗憾,无法将您的查询直接映射到Firebase数据库上的等效内容。 我强烈建议您开始将数据模型映射到更适合NoSQL数据库的东西,而不是尝试使Firebase的NoSQL数据库做SQL技巧。 本篇关于NoSQL数据建模的文章以及我们针对SQL开发人员的Firebase新视频系列,可以 ...
-
1到多个firebase查询(1 to many firebase query)[2022-04-17]
要获取属于product2的所有类别,您应该使用: firebase.database().ref('products/product2/categories').on('child_added', snapshot => { firebase.database().ref('category/'+snapshot.key).on('value', snap => { console.log(snap.val().name + ' belongs to product2'); //W ... -
Firebase查询出现问题(Trouble with a Firebase Query)[2023-10-26]
一些事情; 您的查询格式不正确。 通过定义要搜索的“字段”或节点名称来排序..它是KEY:VALUE对的KEY部分。 [fb queryOrderedByChild:@“person1 string”]应该是 [fb queryOrderedByChild:@“要搜索的节点名称”] 让我分解吧 特定 users uid_0 name: "Jay" state: "Florida" uid_1 name: "Leroy" state: "Colorado" 和代码 / ... -
在Firebase中获取查询(Get Query in Firebase)[2021-04-08]
这应该可以做到这一点: Query q = FirebaseDatabase.getInstance() .getReference("Posts") .orderByChild("CurrentUserID") .equalto("1Qclku47lEhrB7VWGqSOQuWpPhM2"); This should do the trick: Query q = FirebaseDatabase.getInstance() ... -
我想到了。 为了找到一个特定的节点,在我的例子中是最新的帖子(根据我问题上显示的给定数据结构显示为Post对象),我不得不使用addListenerForSingleValueEvent来获取Firebase DataSnapshot,然后从那里我可以循环遍历子节点节点找到我想要的东西。 Query publishedPostsQuery = mFirebaseDatabase.child("posts") .limitToFirst(100); published ...
-
如何在Firebase中执行以下查询?(How to do the following query in Firebase? (more than one where condition) [duplicate])[2023-10-25]
Firebase目前仅支持每个查询一个orderBy 。 因此,如果您想要在多个属性上过滤(或订购),您需要在JavaScript代码中对客户端进行额外的过滤(或排序),否则您将不得不提出自己的索引方案结合了属性。 Firebase currently only supports a single orderBy per query. So if you want to filter (or order) on more than one property, you'll either have to do ... -
来自Firebase的复杂查询(Complex query from Firebase)[2022-07-24]
要获取持续时间 startDate ,只需将其查询到特定节点的所需位置: - FIRDatabase.database().reference().child("user/\(FIRAuth.auth()!.currentUser!.uid)/logs").observeSingleEvent(of: .value, with: {(userSnap) in if let SnapDict = userSnap.value as? [String:AnyObject]{ for each in S ... -
您似乎已经将必要的值编码到项目的键中。 鉴于此,您可以使用该键来查找匹配的子项: var ref = firebase.database().ref('S01/Products'); var query = allProducts.orderByKey().startAt("C09M03S03").endAt("C09M03S04"); query.on("value", function(snapshot) { snapshor.forEach(function(child) { consol ...
-
在firebase中查询(Query in firebase)[2023-10-09]
你确实需要遍历所有的父亲和孩子。 您可以使用Firebase的新查询查询子项,但不能查询子项的子项。 以下是对10岁的孙子女采取行动的例子。 var fathersRef = new Firebase('https://your.firebaseio.com'); fathersRef.on('child_added', function(fatherSnap) { fatherSnap.ref().on('child_added', function(childSnap) { childSn ...