Skip to content

Scrollzoom off on maps with fixed position #60

@yhahn

Description

@yhahn

Test case:

http://bl.ocks.org/4601671

From MapBox Support 954

When loading the JS API into a "position: fixed" modal, if you scroll the page past the fold and then zoom in and out via mousewheel, the zoom center point is off zia the same distance the page has scrolled.

Using the code from the mouse position tutorial ( http://mapbox.com/mapbox.js/example/mouse-position/ ), when at the top of the document, the mouse y is 0 when at the top of the map container. The more you scroll down the page, position the cursor at the top of map container, it no longer reads 0, but an offset of how far the page has scrolled.

I've tried CSS position "static", "relative", "absolute" and widths and heights on the map container and it's parents, upto the modal container.

If looks like the zoom point is calculated via the mouse position on the document, not via the window. Is this a know issue or is there a fix?

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