Giter Club home page Giter Club logo

corona-html5-windowsize-plugin's Introduction

logo Corona HTML5 Window Size Plugin

Get browser window sizing information on demand or via event.

Browser Tests

chrome ie firefox safari opera
pass untested pass pass untested

Windows browser unconfirmed.

Installation

  • Download the Corona HTML5 Window Size Plugin respository.
  • Move plugin/windowSize.lua and plugin/windowSize_js.js to the root of your HTML5 project.
  • Require the plugin in your code where you need it.
local windowSize = require("windowSize")

API

getSize

Returns a Table of the browser window size properties, or a Number if property is supplied.

windowSize.getSize([property])

Properties

  • innerWidth
  • innerHeight
  • outerWidth
  • outerHeight
  • screenLeft
  • screenTop

Example

Direct access

local windowSize = require("windowSize")

local info = windowSize.getSize()

print(info.innerWidth) --> 960

Direct access (via property)

local windowSize = require("windowSize")

local innerHeight = windowSize.getSize('innerHeight')

print(innerHeight) --> 960

Event listener

local windowSize = require("windowSize")

local function onBrowserResize()
  local info = windowSize.getSize()

  print(info.innerWidth) --> 1020
end

Runtime:addEventListener( "resize", onBrowserResize )

Demo

A Corona project can be found in the demo directory that can be compiled to an HTML5 build for testing.


©2018 C. Byerley (develephant)

corona-html5-windowsize-plugin's People

Contributors

develephant avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.