Turbo87 / leaflet-sidebar

A responsive sidebar for Leaflet maps
http://turbo87.github.io/leaflet-sidebar/examples/
MIT License
487 stars 157 forks source link

Conflict with plugin twentytwenty #62

Closed LORDSAVEX closed 5 years ago

LORDSAVEX commented 5 years ago

Hi.

I use the twentytwenty plugin in the sidebar on a map created with Leaflet 1.4.0.

There was a problem with 'mousedown' stop, if I remove the line in L.Control.Sidebar.js, the whole map moves, if you leave the line, then twentytwenty does not work correctly (the stripe does not move the image separating the image).

L.marker([70.30,` -126.32], {icon: DivIcon}).addTo(map).on('click', onMarkerClick);
function onMarkerClick(e) {
    $.ajax({
        type: "POST",
        url: 'index.php?object=1',
        success: function(data) {
            $('#sidebar').html(data);
            setTimeout(function () {
                $(".twentytwenty-container").twentytwenty({default_offset_pct: 0.5, click_to_move: true, no_overlay: true});
            },300);
            SideBar.show();
        }
    });
}

and

<div class="twentytwenty-container">
    <img src="/objects/58/001.jpg" />
    <img src="/objects/58/002.jpg" />
</div>

How to make it possible to work 'mousedown' in div.twentytwenty-container without affecting the map?

zedd45 commented 5 years ago

You may have already solved this, but would you happen to have an example repo that you could provide that replicates this issue? Or even a JSFiddle or the like?

LORDSAVEX commented 5 years ago

The problem has not solved. In the end, simply refused twentytwenty. Replaced with JuxtaposeJS, with this plugin no problems.

zedd45 commented 5 years ago

I'm going to go ahead and close this for now, but if someone else encounters this issue, please feel free to re-open (please include a minimal example to reproduce if possible)!