Search code examples
javascriptbrowserresponsive-designprocessing.js

how can processing.js detect browser's size?


As mentioned, how can processing.js respond to a browser's size? (responsive design) i've tried screen.width and screen.height but it didn't work well. It seems only detect the size of the computer's screen size.

What's more, i want to keep pace with the window's size when dragged and changed the size of the browser


Solution

  •  size(window.innerWidth, window.innerHeight); 
    

    according to https://groups.google.com/forum/?fromgroups=#!topic/processingjs/2-U_P7_BHlY

    or

    void setup() {
    size( $(window).width(),
        $(window).height() );
    ...
    }
    

    according to Get Viewport Width With JQuery and Use In Processing JS