Simple way of doing cross browser pointer lock
CoffeeScript Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Simple way of doing cross browser pointer lock. It also makes it fullscreen, as on older versions of Firefox, it is required to be fullscreen in order to get the pointer lock.

Live Demo

Based on the following:

Example of usage (on gh-page)

window.onload = ->
    showStatus = (str) ->
        document.querySelector("#status").textContent = str
    button = document.querySelector("#click")
        onEnable: ->
            console.log "enabled!"
            showStatus "locked!"
        onDisable: ->
            console.log "disabled!"
            showStatus "not locked"
    button.addEventListener("click", -> PointerLock.fullScreenLock(document.querySelector("body")))


Created by Daniel Ribeiro.

Released under the MIT License: