0

I have built a game from flash to html5 (simple div structure, animations with javascript) which has to fit in one screen so no scroll.

How i can achieve this?

Thanks.

  • If you give us some code, and an example of what you've tried - we might be able to help. – Tom Jan 26 '17 at 08:58
  • This is *very* broad in its current form. Can you show what kind of screen/elements/JS code you have, and how you are running into problems scaling them? (Make sure to provide only the relevant bits though.) – Pekka Jan 26 '17 at 08:58
  • I have tried to do it with css by having the layout fixed heightwise and then adjusting the inner elements but that is work of years to adjust everything for every pixel of screens so am trying to find an alternative way @thebluefox – Anahit Ghazaryan Jan 26 '17 at 09:00
  • Percentages.... – Tom Jan 26 '17 at 09:02
  • why don't you fix the scale using css? then just use media queries to adjust the width/height depending on the screen size? – krisph Jan 26 '17 at 09:15
  • i can go with that but that will mean to go pixel by pixel for all the screen resolutions from biggest to small @krisph. – Anahit Ghazaryan Jan 26 '17 at 09:22
  • Then set the scale using javascript/jquery after calculating the scale needed with the screen width – krisph Jan 26 '17 at 09:36
  • Can you give me an example of how i can calculate the right scale in percentage @krisph? – Anahit Ghazaryan Jan 26 '17 at 09:44
  • http://stackoverflow.com/questions/3588628/can-i-change-the-viewport-meta-tag-in-mobile-safari-on-the-fly <-- Look at the following for changing the viewport with javascript, you will need to use somthing like var height = document.body.clientHeight; var width = document.body.clientWidth; to deterrmin what ratio you need it to be – krisph Jan 26 '17 at 09:55
  • Ok but how to know the right css zoom percentage? – Anahit Ghazaryan Jan 26 '17 at 10:03
  • don't quote me on this but say you needed 1000 pixels and the screen was 2000 pixels 2000/1000=2. alternatively you could always set the width and height ratio with the viewport – krisph Jan 26 '17 at 10:35

0 Answers0