Custom Fields
Re-Envisioned
Support Meta Box Geolocation Open Street Map: Unable to scroll to the bottom with fullwidth map

  • Creator
    Topic
  • #31116
    Kirb
    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #31120
    Long 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
    Kirb
    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 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 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.