<div dir="ltr"><p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Hi all,</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">As I've
worked on Sugarizer v0.5, I was faced to the need to adapt web activities to a
responsive design. Shortly, it means
that activities could be usable with different screen resolution from
smartphone to PC. I would like to share with you some lessons I've learnt. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"><span style="font-weight:bold;text-decoration:underline">1) Think to multiple screen</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">"old"
activities was conceived for the XO resolution (1200x900) or at best for a PC
screen size. With possibility to run activities on any device, you have to
support lower screens too. I've choose to support 480x320 (small smartphone),
1024x768 (small tablet), 960x540 (medium smartphone). It could be interesting
to support greater resolution too like 1920x1200 (HD Tablets). More on current
screen sizes here [1].</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Note also
that smartphone screens are used in portrait mode but to avoid complexity I've
choose to force landscape in Sugarizer. So you could consider that the width is
bigger than height.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Note that
Firefox include a very nice tool to test multiple resolution [2].</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"><span style="font-weight:bold;text-decoration:underline">2) Use percent instead of
pixel</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">To set
size of objects, you should replace in your CSS file pixel size by percent.
Instead of pixel, percent is size independent. Do the same for positioning too.
For example, in one of my activity I've replaced:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">.game-popup
{</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">left:
400px;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">top:
460px;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">width:
250px;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">by:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">.game-popup
{</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">left:
25%;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">top:
55%;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">width:
40%;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt" lang="en-US">}</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Note
however that it don't work for height because height is computed during page
rendering.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">In that
case or when you really need to use pixel size, you could use max-height and
max-width like in:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">height:
300px;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">max-height:
30%;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Finally,
note that as specified on 1), screen resolution are not only different but has
different width/height ratio. For example ratio is 1.5 for 480x320 and 1.7 for
960x540. You should take that into account when you compute size of page
elements.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"><span style="font-weight:bold;text-decoration:underline">3) Adapt content</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Using
percent is not sufficient. You will have to change your page depending of the
screen resolution. The better place to do that is in the CSS file. More
precisely, you could use media queries to adapt dynamically items size to the
current screen size. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Let's
take an example from one of my activity. As you could see: width, font and
border are specified for each resolution.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">@media
screen and (max-width: 480px) { </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.shadowbutton-image
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">width:
60px;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.card
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">border-width:
3px;</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">box-shadow:
3px -2px 2px 1px black; </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">} </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.cardText
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">font-size:
12px; </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.home
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">top:
24%;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">} </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">@media
screen and (min-width: 481px) and (max-width: 640px) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.shadowbutton-image
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">width:
80px;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.card
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">border-width:
4px;</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">box-shadow:
4px -3px 3px 2px
black; </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">} </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">.cardText
{</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">font-size:
14px; </p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Sometimes,
playing with size will not be sufficient. In that case, you could think to hide
or shorten some items in your UI. </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">For
example Gears activity automatically hide help button if the screen is too
small.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">@media
screen and (max-width: 567px) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">#main-toolbar
#help-button {</p>
<p style="margin:0in 0in 0in 1.125in;font-family:Calibri;font-size:11pt">visibility:
hidden;</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Or
GridPaint activity compute in JavaScript a canvas zoom to adapt drawing to the
screen size.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">var
wsize = document.body.clientWidth;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">if
(wsize <= 480) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 0.353;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}
else if (wsize <= 640) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 0.501;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}
else if (wsize <= 854) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 0.565;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}
else if (wsize <= 960) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 0.645;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}
else if (wsize <= 1024) {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 0.95;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}
else {</p>
<p style="margin:0in 0in 0in 0.75in;font-family:Calibri;font-size:11pt">zoom
= 1.10;</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">}</p>
<p style="margin:0in 0in 0in 0.375in;font-family:Calibri;font-size:11pt">document.getElementById("canvas").style.zoom
= zoom;</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"><span style="font-weight:bold;text-decoration:underline">4) Set viewport in your HTML
pages</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Since
emergence of smartphone and thanks to the first iPhone, smartphones automatic
zoom pages to ensure that it could fit into a small screen. This feature is
great when you want to display a HTML page adapted to a PC screen but it's not
at all practical when you write a responsive design interface where you try to
adapt yourself the content to the screen size.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">A
specific tag on your HTML allow you to tell to the mobile browser that you
don't want an automatic zoom. It's:</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><meta
name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width,
height=device-height"/></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Shortly
it means to use device width and height and to ignore zoom. Always think to
include this tag in your HTML header. More on the viewport tag here [3]</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"><span style="font-weight:bold;text-decoration:underline">5) Take care to DPI</span></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Managing
screen width and height is not sufficient. Rendering on smartphone and tablet
screens depend of pixel density or DPI (i.e. Dot Per Inch). The more the
density is the more it impact the real width and height size. Recent
smartphones and tablets use high DPI as a marketing argument to sell devices
(think to "Retina"). Shortly, on high density screens 1 pixel width
could be represented by 2 (or more) real pixels width. So of course, testing on
a PC screen (where 1 pixel = 1 pixel) will not give the same result than on the
real device. Only testing on real device with different DPI size will guaranty
that your activity will fit correctly.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">A good
explanation of DPI could be read here [4].</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Hope that
all these explanations will help you to write adaptive activities.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Do not
hesitate to have a look on activities include into Sugarizer to a better
understanding of how responsive design work. Do not hesitate too to ask me for
help.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US">Best
regards from France.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> Lionel.</p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt" lang="en-US"> </p>
<p style="margin:0in;font-family:Calibri;font-size:11pt"><span lang="en-US">[1]
</span><a href="http://brandongaille.com/10-most-common-screen-resolution-statistics-and-trends/"><span lang="fr">http://brandongaille.com/10-most-common-screen-resolution-statistics-and-trends/</span></a></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">[2] <a href="https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_View">https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_View</a></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">[3] <a href="https://developer.mozilla.org/docs/Mozilla/Mobile/Balise_meta_viewport">https://developer.mozilla.org/docs/Mozilla/Mobile/Balise_meta_viewport</a></p>
<p style="margin:0in;font-family:Calibri;font-size:11pt">[4] <a href="http://developer.android.com/guide/practices/screens_support.html">http://developer.android.com/guide/practices/screens_support.html</a></p></div>