Open Street Map: Unable to scroll to the bottom with fullwidth map

Support MB Geolocation Open Street Map: Unable to scroll to the bottom with fullwidth mapResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31116
    JamesJames
    Participant

    It is very difficult to scroll to the bottom of the page because you get stuck inside the map if it is a fullwidth map. Unlike google map, their map has scroll ctrl+scroll. How can we fix that in open street map?

    #31120
    Long NguyenLong Nguyen
    Moderator

    Hi Kirb,

    You can turn off the JS option scrollWheelZoom of the OSM field. Please read more on the documentation
    https://docs.metabox.io/fields/osm/#displaying-the-map
    https://leafletjs.com/reference-1.7.1.html#map-scrollwheelzoom

    #31126
    JamesJames
    Participant

    Hi, Long. Is this the correct call In functions.php?

    function my_map() {
        $args = array(
            'width'      => '640px',
            'height'     => '480px',
            'js_options' => array(
                'doubleClickZoom' => false,
                'scrollWheelZoom' => false,
            )
        );
        echo RWMB_Map_Field::render_map( 'osm_map', $args );
    }

    In the views

    {{ mb.my_map() }}

    #31133
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If the field osm is the top field, you need to use the helper function rwmb_meta().

    echo rwmb_meta( 'osm_map', $args );

    If the field osm is a subfield in a group, you need to get the group value first.

        $group_value = rwmb_meta( 'group_id' );
        $args = array(
            'width'      => '640px',
            'height'     => '480px',
            'js_options' => array(
                'doubleClickZoom' => false,
                'scrollWheelZoom' => false,
            )
        );
        echo RWMB_Map_Field::render_map( $group_value['osm_map'] );
    

    Please read more on the documentation https://docs.metabox.io/fields/osm/#template-usage

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.