选中/取消选中所有按钮以显示/隐藏所有标记Google Maps API [英] Check/uncheck all button to show/hide all markers Google maps api

查看:131
本文介绍了选中/取消选中所有按钮以显示/隐藏所有标记Google Maps API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁可以帮我解决以下问题:我从几个来源组合了一些javascript来制作带有下拉菜单的谷歌地图。在这个菜单中,我可以通过分类在地图上放置/隐藏标记。
这部分工作正常,但现在我试图让菜单中的全部检查/全部取消按钮工作......到目前为止,按钮可以检查/取消选中复选框,但标记在地图上没有相应的回应。



我尝试了几个选项,如
删除所有标记google map v3 &
Google Maps API v3:如何删除所有标记?&
隐藏特定标记谷歌地图API



直到现在我无法让它工作......(我基本的javascript知识非常有限......)
谁能给我一个提示?



这里是一个工作小提琴

 `http://jsfiddle.net/n86zxopp/ `


解决方案

plz check this

I已经更新了您的点击功能,如

pre $函数check(){
$('input [type =checkbox] ').prop(checked,true).change();


函数uncheck(){
$('input [type =checkbox]')。prop(checked,false).change();
}


Who can help me out with the following: from several sources I combined some javascript to make a google map with a dropdown-menu. From this menu I'm able to place/hide markers on the map by categorie. That part works fine, but now I'm trying to get the "check all"/"uncheck all" buttons inside the menu to work... So far the buttons do check/uncheck the checkboxes, but the markers on the map are not responding accordingly.

I tried several options like Remove all markers google map v3 & Google Maps API v3: How to remove all markers? & Hide particular marker google maps api

Untill now i can't get it to work... (my basic javascript knowledge is very limited...) Who can give me a hint?

Here is a working fiddle

 `http://jsfiddle.net/n86zxopp/`

解决方案

plz check this http://jsfiddle.net/n86zxopp/2/

I have updated your click functions like

function check() {
  $('input[type="checkbox"]').prop("checked", true).change();
}

function uncheck() {
  $('input[type="checkbox"]').prop("checked", false).change();
}

这篇关于选中/取消选中所有按钮以显示/隐藏所有标记Google Maps API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆