如何使单张图层可以访问 [英] How to make Leaflet tile layers accessible

查看:299
本文介绍了如何使单张图层可以访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在图层中添加alt标签,并提高应用程序的可访问性分数,特别是 Esri.WorldGrayCanvas ,但是在 http://leaflet-extras.github.io/leaflet-providers/preview/

How can you add an 'alt' tag to tile layers, and raise the accessibility score of an application, in particular to the Esri.WorldGrayCanvas, but any of the tiles found at http://leaflet-extras.github.io/leaflet-providers/preview/?

推荐答案

通过挂载到tileload事件中,您可以操纵平铺图像:

You could manipulate the tile images when they load by hooking into the tileload event:

esriGray.on('tileload', function (tileEvent) {
    tileEvent.tile.setAttribute('alt', 'Map tile image');
});

这样图像总是有alt标签,即使在缩放/平移之后,也没有使用Jquery。

That way the images always have the alt tag, even after zoom/pan and you don't have to use Jquery.

这篇关于如何使单张图层可以访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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