首页 \ 问答 \ 控制定位(Controls positioning)

控制定位(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:

enter image description here

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
更新时间:2023-03-07 10:03

最满意答案

您似乎已经将必要的值编码到项目的键中。 鉴于此,您可以使用该键来查找匹配的子项:

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());
  });
});

相关问答

更多
  • 是的,你可以这样做。 这是一个查找没有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新视频系列,可以 ...
  • 要获取属于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 ...
  • 一些事情; 您的查询格式不正确。 通过定义要搜索的“字段”或节点名称来排序..它是KEY:VALUE对的KEY部分。 [fb queryOrderedByChild:@“person1 string”]应该是 [fb queryOrderedByChild:@“要搜索的节点名称”] 让我分解吧 特定 users uid_0 name: "Jay" state: "Florida" uid_1 name: "Leroy" state: "Colorado" 和代码 / ...
  • 这应该可以做到这一点: 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目前仅支持每个查询一个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 ...
  • 要获取持续时间 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的新查询查询子项,但不能查询子项的子项。 以下是对10岁的孙子女采取行动的例子。 var fathersRef = new Firebase('https://your.firebaseio.com'); fathersRef.on('child_added', function(fatherSnap) { fatherSnap.ref().on('child_added', function(childSnap) { childSn ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。