- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有Australia的jvectormap 。单击 map 中的特定州时,它应该缩小同一 map 中的该特定州。有没有办法在不使用多 map 的情况下实现这一点。
最佳答案
是的,当然 - 你的意思是放大?使用 map 对象的 setFocus 方法:
onRegionClick: function(e, code, isSelected, selectedRegions){
$('#map').vectorMap('get','mapObject').setFocus({region: code});
}
编辑:
setFocus 方法记录如下:jVectorMap API Documentation - Map
这是 setFocus 的摘录(来源:Kirill Lebedev,jVectorMap 的伟大作者):
/**
* setFocus set the map's viewport to the specific point and set zoom of the map
to the specific level. Point and zoom level could be defined
in two ways: using the code of some region to focus on or a central point
and zoom level as numbers.
* @param This method takes a configuration object as the single argument.
The options passed to it are the following:
* @param {Array} params.regions Array of region codes to zoom to.
* @param {String} params.region Region code to zoom to.
* @param {Number} params.scale Map scale to set.
* @param {Number} params.lat Latitude to set viewport to.
* @param {Number} params.lng Longitude to set viewport to.
* @param {Number} params.x Number from 0 to 1 specifying the horizontal
coordinate of the central point of the viewport.
* @param {Number} params.y Number from 0 to 1 specifying the vertical
coordinate of the central point of the viewport.
* @param {Boolean} params.animate Indicates whether or not to animate
the scale change and transition.
*/
某些选项是互斥的,例如,如果您提供纬度和经度,显然 x 和 y 值(以像素为单位的 map 坐标)将被忽略。此外:同样,如果您提供一个区域代码或一组区域代码、纬度和经度以及 x 和 y 值,它们都将被忽略。
要获得动画效果,您应该向参数对象提供选项animate: true
。
示例:
$('#map').vectorMap('get','mapObject').setFocus({region: code, animate: true});
要获得漂亮且平滑的效果,您应该使用 scale
参数,这是因为用户可以放大 map ,然后单击某个区域,然后,由于这个原因,该区域的缩放效果不会如期望的那么明显。或其他任何东西,也取决于您的初始缩放级别。
因此,您可以研究用户界面,规划用户交互,并使用缩放选项进行一些测试以获得所需的效果(抱歉,我无法进一步提供帮助,因为您没有提供任何源代码)。
从这里开始,尝试获得您最终想要的动画效果:
// Zoom in to the Eyers Rock:
var zParams = {scale: 5, lat: -25.360790, lng: 131.016800, x: 0.5, y: 0.5, animate: true};
$('#map').vectorMap('get','mapObject').setFocus(zParams);
关于jquery - jvectormap 中单击事件时自动缩放区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42710155/
我正在更新我们的应用程序以使用 jVectorMap 而不是 Flash。有些 map 需要将国家/地区涂上不同的颜色。创建起来非常简单。 var myData = {
我想请查看我的来源。 我有问题:我需要更改国家/地区颜色,但颜色:...功能对我不起作用。 map 为白色,颜色不变。 请回答。 谢谢! jQuery.noConflict(); jQuery(fu
我正在尝试验证是否可以使用 jvectormap 在 map 上的标记之间绘制线条。 这是我想要实现的目标:http://i.imgur.com/p1Zypv3.gif 有人可以给我一个提示是否可行,
我正在使用 J Vector Map ( http://jvectormap.com/documentation/javascript-api/ ) 创建美国 map 。 我想要做的是为每个州提供一个
我正在使用 jVectorMap 插件将 map 添加到网站。这是我在页面加载时添加标记的 map 。有没有办法动态地做到这一点?我需要通过鼠标单击添加它们。我使用 jVectorMap 插件
与 jVectorMap是否可以隐藏缩放按钮并使用 API 调用放大/缩小?我查过the API documentation并且找不到任何方法,导致 map 重新缩放。 最佳答案 当然。 隐藏按钮:
我正在使用 JVectorMap 显示带有彩色国家/地区的 map 。该 map 还包括一个图例和一个 onRegionTipShow。在我的应用程序中,可以更改 map 所基于的值。执行此操作后,应
所以我想根据我将鼠标放在的国家/地区在我的 Jvectormap 标签上添加图像。我已经设法做到了,但问题是,或者它总是同一张图片,或者我在 map 上的所有其他标签上看到“图像未找到”图标。这是我最
我正在尝试删除笔划并悬停在 jVector map 上的区域 - http://jvectormap.com/ 这是我在js中调用的代码: $(function(){ var markers
jVectorMaps 中是否可以定义可以选择的静态区域? 我只需要定义允许用户选择的 6 个区域。 棘手的部分是,我需要将欧洲、亚洲和世界作为一个地区以及“波兰”和“加拿大”。 如果用户选择波兰,则
当我从外部链接中选择一个区域时,我需要显示一个 HTML 标签。我可以使用以下方法选择区域:map.setSelectedRegions([region]) 但这不显示区域标签。 谁能帮我解决这个问题
我似乎找不到他的插件的任何支持论坛... 我有一个按钮,我想在点击时关注欧洲。 例如,我可以专注于区域,目前我有 $('#map1').vectorMap('set', 'focu
我正在使用 jVectorMap 通过着色显示国家/地区值(即,国家/地区根据其值使用不同的颜色)。一切正常,除非某些国家/地区包含在数据集中。然后这些国家并没有像他们应该的那样被着色(事实上,它们根
我正在使用 http://jvectormap.com/对于在内部使用 webview 的 iOS 应用程序。我的问题是当我在世界地图上触摸一个国家时会出现黑色闪烁。 您甚至可以在 iPad 或 iP
我想为 JVectorMap 插件设置单个区域和悬停颜色,并将没有数据的区域保留为默认白色。 到目前为止,我已经删除了比例数据并用颜色代码替换它(如下面的代码所示)。这太棒了,但我不知道如何添加悬停数
我正在尝试显示我在 map 上突出显示的唯一区域的标签。 这是代码: var map = $('#map').vectorMap({ regionsSelectable: true,
我有Australia的jvectormap 。单击 map 中的特定州时,它应该缩小同一 map 中的该特定州。有没有办法在不使用多 map 的情况下实现这一点。 最佳答案 是的,当然 - 你的意思
我有一张从 SVG 文件转换而来的 map ,现在我想在该 map 上的光标位置添加标记。但标记位置错误,且不遵循任何规则,无法正确监控和修改。 从这个例子:http://jvectormap.com
我有一个使用以下代码创建的 jVectorMap var vmap = $('#world-map').vectorMap({ regionsSelectable: true, reg
我如何设计这样的“world_mill_en” map ? 我知道如何做标记,只需指定经度和纬度即可。我将如何摆脱各大洲之间的所有分界线,并更改填充以使其只是一堆灰点?据我所知,该 api 只允许您将
我是一名优秀的程序员,十分优秀!