<legend id='KmUKH'><style id='KmUKH'><dir id='KmUKH'><q id='KmUKH'></q></dir></style></legend>

    <small id='KmUKH'></small><noframes id='KmUKH'>

    1. <i id='KmUKH'><tr id='KmUKH'><dt id='KmUKH'><q id='KmUKH'><span id='KmUKH'><b id='KmUKH'><form id='KmUKH'><ins id='KmUKH'></ins><ul id='KmUKH'></ul><sub id='KmUKH'></sub></form><legend id='KmUKH'></legend><bdo id='KmUKH'><pre id='KmUKH'><center id='KmUKH'></center></pre></bdo></b><th id='KmUKH'></th></span></q></dt></tr></i><div id='KmUKH'><tfoot id='KmUKH'></tfoot><dl id='KmUKH'><fieldset id='KmUKH'></fieldset></dl></div>
    2. <tfoot id='KmUKH'></tfoot>

        <bdo id='KmUKH'></bdo><ul id='KmUKH'></ul>

      如何将类添加到传单标记?

      时间:2023-08-09
      <i id='ylOCS'><tr id='ylOCS'><dt id='ylOCS'><q id='ylOCS'><span id='ylOCS'><b id='ylOCS'><form id='ylOCS'><ins id='ylOCS'></ins><ul id='ylOCS'></ul><sub id='ylOCS'></sub></form><legend id='ylOCS'></legend><bdo id='ylOCS'><pre id='ylOCS'><center id='ylOCS'></center></pre></bdo></b><th id='ylOCS'></th></span></q></dt></tr></i><div id='ylOCS'><tfoot id='ylOCS'></tfoot><dl id='ylOCS'><fieldset id='ylOCS'></fieldset></dl></div>
        <tbody id='ylOCS'></tbody>
      • <bdo id='ylOCS'></bdo><ul id='ylOCS'></ul>
          • <legend id='ylOCS'><style id='ylOCS'><dir id='ylOCS'><q id='ylOCS'></q></dir></style></legend>
            <tfoot id='ylOCS'></tfoot>
          • <small id='ylOCS'></small><noframes id='ylOCS'>

                本文介绍了如何将类添加到传单标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在为传单标记使用自定义 divIcon.我想用一些简单的 CSS 为我点击的任何标记添加边框:

                I'm using custom divIcons for my Leaflet markers. I want to add a border to whatever marker I click on, with some simple CSS:

                .selectedMarker {
                border: 10px solid gold;
                }
                

                但是,以下 jQuery 不起作用:

                However, the following with jQuery doesn't work:

                $(marker).addClass('selectedMarker');
                

                然后我尝试使用 Leaflet 自己的 addClass() 方法.我尝试通过以下方式调用使用它:

                Then I tried to use Leaflet's own addClass() method. I tried to call use it in the following ways:

                marker.addClass('selectedMarker');
                L.addClass(marker, 'selectedMarker');
                addClass(marker, 'selectedMarker');
                DomUtil.addClass(marker, 'selectedMarker');
                

                这些都不起作用.如何将 selectedMarker 类添加到我的标记中?

                None of these work. How do I add the selectedMarker class to my marker?

                推荐答案

                我已经通过在标记中添加一个类来实现

                I have done it by adding a class to the marker with

                var marker = L.marker(loc);
                marker.on('click', function() {
                    $(marker._icon).addClass('selectedMarker');
                }
                

                然后使用css

                .leaflet-marker-icon.selectedMarker{
                  //your css
                }
                

                这篇关于如何将类添加到传单标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在 Shiny 中保存带有绘制形状/点的传单地图 下一篇:如何在“popupopen"事件期间识别 Leaflet 的标记

                相关文章

                最新文章

              • <small id='iE4qe'></small><noframes id='iE4qe'>

                  <legend id='iE4qe'><style id='iE4qe'><dir id='iE4qe'><q id='iE4qe'></q></dir></style></legend>

                    <bdo id='iE4qe'></bdo><ul id='iE4qe'></ul>
                  <i id='iE4qe'><tr id='iE4qe'><dt id='iE4qe'><q id='iE4qe'><span id='iE4qe'><b id='iE4qe'><form id='iE4qe'><ins id='iE4qe'></ins><ul id='iE4qe'></ul><sub id='iE4qe'></sub></form><legend id='iE4qe'></legend><bdo id='iE4qe'><pre id='iE4qe'><center id='iE4qe'></center></pre></bdo></b><th id='iE4qe'></th></span></q></dt></tr></i><div id='iE4qe'><tfoot id='iE4qe'></tfoot><dl id='iE4qe'><fieldset id='iE4qe'></fieldset></dl></div>

                  <tfoot id='iE4qe'></tfoot>