Moving map to the center after folding the sidebar

I was wondering how to make my leaflet map displayed slightly to right with using css, so I won’t have to set setview or center values for that. After I fold the sidebar I want the map to come back to center of the site. I tried something with add left:10% to leaflet.css but it messes with the coords popup.

function setupMap() {
    let mapData; // Zmienna do przechowywania danych mapy

    // Pobranie bieżącej ścieżki URL
    const currentPath = window.location.pathname;

    // Sprawdzenie ścieżki i ustawienie odpowiednich wartości
    if (currentPath.includes('/white_orchard/')) {
        mapData = mapdata_wo; // Użyj danych z mapdata_wo
    } else if (currentPath.includes('/velen_novigrad/')) {
        mapData = mapdata_vn; // Użyj danych z mapdata_vn
    } else {
        console.error('Nieznana ścieżka mapy');
        return;
    }

    var bounds = L.latLngBounds(mapData.sWest, mapData.nEast);
    var map = L.map('mapid', {
        zoomControl: false,
        center: mapData.map_center, // Ustawienie poprawnych współrzędnych (lat, lng)
        zoom: mapData.map_zoom,
        maxZoom: mapData.max_zoom,
        minZoom: mapData.min_zoom,
        attributionControl: false,
        zoomSnap: 0.5,  // Umożliwia zoom co 0.5
        zoomDelta: 0.5,
        maxBounds: bounds,
        maxBoundsViscosity: 0,
        fullscreenControl: true
    });

    function addBoundaryLine() {
        var corners = [
            [mapData.sWest.lat, mapData.sWest.lng],  // Dolny lewy róg
            [mapData.nEast.lat, mapData.sWest.lng],  // Górny lewy róg
            [mapData.nEast.lat, mapData.nEast.lng],  // Górny prawy róg
            [mapData.sWest.lat, mapData.nEast.lng],  // Dolny prawy róg
            [mapData.sWest.lat, mapData.sWest.lng]   // Zamknięcie obwodu (powrót do dolnego lewego rogu)
        ];

        // Dodanie polilinii (linii wielokątnej) z czerwoną linią
        var boundaryLine = L.polyline(corners, {
            color: 'red',   // Kolor linii
            weight: 2,      // Grubość linii
            opacity: 1      // Przezroczystość
        }).addTo(map);
    }

    // Wywołanie funkcji po załadowaniu mapy
    addBoundaryLine();

    // Dodanie kontrolek zoomu
    L.control.zoom({
        position: 'bottomright',
        zoomInTitle: 'Przybliż',
        zoomOutTitle: 'Oddal'
    }).addTo(map);

    // Okienko z koordynatami
    map.on('click', function (e) {
        var coords = e.latlng;
        var lat = coords.lat.toFixed(5);
        var lng = coords.lng.toFixed(5);
        console.log('Map clicked at:', lat, lng);
        L.popup()
            .setLatLng(coords)
            .setContent("Koordynaty: " + lat + ", " + lng)
            .openOn(map);
    });

    // Dodanie warstwy kafelków z opcją TMS
    L.tileLayer(mapData.map_path + '.jpg', {
        tms: true, // Ustawienie odwrotnej numeracji kafelków
        noWrap: true,
        bounds: bounds,
        maxZoom: mapData.max_zoom,
        minZoom: mapData.min_zoom,
        continousWorld: true,
    }).addTo(map);
}


// Wywołanie funkcji po załadowaniu DOM
document.addEventListener('DOMContentLoaded', function () {
    setupMap();
});


document.addEventListener('DOMContentLoaded', () => {
    const container = document.getElementById('container');
    const button = document.getElementById('toggleButton');
    const image = document.getElementById('toggleImage');
    const hideableDiv = document.getElementById('hideableDiv');
    var mapElement = document.getElementById('mapid');

    button.addEventListener('click', () => {
        const isHidden = hideableDiv.style.display === 'none';
        if (isHidden) {
            hideableDiv.style.display = 'block'; // Pokazuje div
            image.src = '/resources/images/cc_greaterthan-left.png'; // Zmienia obrazek
        } else {
            hideableDiv.style.display = 'none'; // Ukrywa div
            image.src = '/resources/images/cc_greaterthan-right.png';
        }
        // if (mapElement.classList.contains('map-move-left')) {
        //     mapElement.classList.remove('map-move-left');
        // } else {
        //     mapElement.classList.add('map-move-left');
        // }
    });
});

function showCategory(category) {
    document.querySelectorAll('.text-box').forEach((cat) => {
        cat.style.display = (category === 'all' || cat.id === category) ? 'block' : 'none';
    });
}

document.addEventListener('DOMContentLoaded', () => {
    const rightToggleButton = document.getElementById('rightToggleButton');
    const rightContent = document.getElementById('rightContent');
    const secondRightToggleButton = document.getElementById('secondRightToggleButton');
    const secondRightContent = document.getElementById('secondRightContent');

    rightToggleButton.addEventListener('click', () => {
        const buttonRect = rightToggleButton.getBoundingClientRect();
        rightContent.style.top = (buttonRect.top - 10) + 'px';
        rightContent.style.display = rightContent.style.display === 'none' ? 'block' : 'none';
        secondRightContent.style.display = 'none'; // Ukryj drugie okienko
    });

    secondRightToggleButton.addEventListener('click', () => {
        const buttonRect = secondRightToggleButton.getBoundingClientRect();
        secondRightContent.style.top = (buttonRect.top - 10) + 'px';
        secondRightContent.style.display = secondRightContent.style.display === 'none' ? 'block' : 'none';
        rightContent.style.display = 'none'; // Ukryj pierwsze okienko
    });
});

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật