Skip to content

Stop the web page from scrolling to the top when the Reset View Control is clicked. #1

@itamair

Description

@itamair

If the Leaflet Map is not at the top scroll of the web page, the click of the Reset View Control makes the page scrolling all to the top, eventually even making the map itself to disappear ...

Hence we need to stop the web page from scrolling to the top when the Reset View Control is clicked,
and this post highlights the proper solution:
https://stackoverflow.com/questions/1601933/how-do-i-stop-a-web-page-from-scrolling-to-the-top-when-a-link-is-clicked-that-

Adding

e.preventDefault();

before the following:

this._map.setView(this.options.latlng, this.options.zoom);

solves this issue to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions