SlideShare ist ein Scribd-Unternehmen logo
1 von 60
Downloaden Sie, um offline zu lesen
Salvatore Iaconesi
salvatore.iaconesi@artisopensource.net




FROM DESIGN
TO APPLICATION
Crash course per designer visuali: dal concept all'applicazione smartphone/tablet
CRASH
COURSE
COSA USEREMO



      PHONEGAP
      IOS SDK BY APPLE
      XCODE DEVELOPMENT ENVIRONMENT

      per scaricare i software:
      http://www.phonegap.com/
      http://developer.apple.com/

LE APPLICAZIONI SVILUPPATE IN QUESTO MODO POTRANNO
ESSERE IMMEDIATAMENTE PORTATE ALLA PIATTAFORMA
ANDROID (INSTALLARE AMBIENTE DI SVILUPPO ECLIPSE ED
ESEGUIRE IL TOOL DI INSTALLAZIONE APPOSITO FORNITO
INSIEME A PHONEGAP)
STEP PRELIMINARI:

1) INSTALLARE XCODE
2) INSTALLARE PHONEGAP
3) COMPILARE L'APPLICAZIONE DI DEFAULT
TUTTO OK?

PERFETTO ALLORA:


IMPARIAMO COME SI COSTRUISCE
UNA APPLICAZIONE IPHONE/IPAD
(MA ANCHE ANDROID, BLACKBERRY, WEBOS,
SYMBIAN...)




USANDO HTML5 E CSS
IMPORTANTISSIMO!

LEGGERE QUESTE GUIDELINES
IN CUI APPLE SPIEGA LE BEST PRACTICES DA
SEGUIRE IN QUESTO GENERE DI ATTIVITA'


ORA NE VEDREMO ALCUNI PASSI FONDAMENTALI
HTML + CSS GUIDELINES & BEST PRACTICES




USE STANDARDS

       HTML 4.01
       XHTML 1.0
       CSS 2.1 and partial CSS3
       ECMAScript 3 (JavaScript)
       DOM Level 2
       AJAX technologies, including XMLHttpRequest
HTML + CSS GUIDELINES & BEST PRACTICES




GOOD WEB DESIGN
PRACTICES

      USE DOCTYPE
      SEPARATE HTML E CSS FILES
      WELL STRUCTURED HTML
      USE BROWSER INDEPENDENT CODE
HTML + CSS GUIDELINES & BEST PRACTICES




USE SECURITY FEATURES


       SSL
       HTTPS
HTML + CSS GUIDELINES & BEST PRACTICES




NO FRAMESETS!
USE BLOCKS! (DIV, SPAN..)
CHECK SIZE OF WEB PAGE
HTML + CSS GUIDELINES & BEST PRACTICES




USE THE <SELECT> ELEMENT
USE ALERT, CONFIRM, PROMPT
USE HTML5 AUDIO AND VIDEO

REMEMBER DIFFERENCE BETWEEN
CLICK AND TOUCH
HTML + CSS GUIDELINES & BEST PRACTICES




 USE CONDITIONAL STYLESHEET
EXAMPLE:


SPECIFY STYLESHEET FOR IPHONE
<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">


OR, INSIDE THE CSS FILE:
@media screen and (min-device-width: 481px) { ... }
HTML + CSS GUIDELINES & BEST PRACTICES




 USE VIEWPORT
<meta name = "viewport" content = "width = device-width">

<meta name = "viewport" content = "initial-scale = 1.0">

<meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no">

<meta name = "viewport" content = "width = 590">

<meta name = "viewport" content = "user-scalable=no, width=device-width">
HTML + CSS GUIDELINES & BEST PRACTICES




 USE WEBKIT
VEDI THIS LINK PER CAPIRE LE ESTENSIONI DEL BROWSER
MOBILE DISPONIBILE SU IPHONE/IPAD

ESTENSIONI COME:

-webkit-border-image
-webkit-border-radius
-webkit-text-size-adjust
-webkit-tap-highlight-color
-webkit-animation
-webkit-mask
-webkit-transition
HTML + CSS GUIDELINES & BEST PRACTICES




FORMS
HTML + CSS GUIDELINES & BEST PRACTICES




EVENTS

 RENDERE GLI OGGETTI CLICKABLE PER
 CONTROLLARLI DA JAVASCRIPT




   <span onmouseover = "..."
     onmouseout = "..."
     onclick = "void(0)">

   WHERE TO BUY

   </span>
HTML + CSS GUIDELINES & BEST PRACTICES




 EVENTS
PER GESTIRE GLI EVENTI MULTITOUCH:

 <div                                                                      Alternatively, register handlers in JavaScript as follows:
   ontouchstart="touchStart(event);"
   ontouchmove="touchMove(event);"                                         element.addEventListener("touchstart", touchStart, false);
   ontouchend="touchEnd(event);"                                           element.addEventListener("touchmove", touchMove, false);
   ontouchcancel="touchCancel(event);"                                     element.addEventListener("touchend", touchEnd, false);
 ></div>                                                                   element.addEventListener("touchcancel", touchCancel, false);



                                                      function touchStart(event) {
                                                        // Insert your code here
                                                      }


Optionally, get all touches on a page using the touches property as follows:
                                                                                                      get the number of touches:
var allTouches = event.touches;
                                                                                                      event.touches.length

Optionally, get all touches for the target element using the targetTouches property:
                                                                                                      Get a specific touch object at index i:
var targetTouches = event.targetTouches;
                                                                                                      var touch = event.touches[i];

Optionally, get all changed touches for this event using the changedTouches property:               get the location in page coordinates for a single-finger event:

var changedTouches = event.changedTouches;                                                            var x = event.touches[0].pageX;
                                                                                                      var y = event.touches[0].pageY;
HTML + CSS GUIDELINES & BEST PRACTICES




EVENTS
MULTITOUCH + JAVASCRIPT




   function touchMove(event) {
       event.preventDefault();
       curX = event.targetTouches[0].pageX - startX;
       curY = event.targetTouches[0].pageY - startY;
       event.targetTouches[0].target.style.webkitTransform =
           'translate(' + curX + 'px, ' + curY + 'px)';
   }
HTML + CSS GUIDELINES & BEST PRACTICES




GESTURES
<div                                                               var angle = event.rotation;
  ongesturestart="gestureStart(event);"
  ongesturechange="gestureChange(event);"
  ongestureend="gestureEnd(event);"                                var scale = event.scale;
></div>



function gestureChange(event) {
  // Insert your code here
}




       onGestureChange: function(e) {
           e.preventDefault();
           e.target.style.webkitTransform =
               'scale(' + e.scale + startScale   + ') rotate(' + e.rotation + startRotation + 'deg)';
       }
INIZIAMO
PRENDIAMO UN DOCUMENTO HTML
   <html>
   <head>
    <link rel="stylesheet" href="screen.css" type="text/css" />
    <title>Salvatore Iaconesi</title>
   </head>
   <body>
   <div id="container">
    <div id="header">
     <h1><a href="./">Salvatore Iaconesi</a></h1>
     <div id="utility">
         <ul>
            <li><a href="about.html">About</a></li>
            <li><a href="blog.html">Blog</a></li>
         </ul>
     </div>
     <div id="nav">
         <ul>
            <li><a href="design.html">Design</a></li>
            <li><a href="progetti.html">Progetti</a></li>
            <li><a href="ricerca.html">Ricerca</a></li>
         </ul>
     </div>
    </div>
    <div id="content">
     <h2>About</h2>
     <p>Salvatore Iaconesi è ingegnere robotico, interaction designer
               artista e insegna cross media design alla Facoltà di
               Architettura dell'Università di Roma "La Sapienza".
               Adora gli animali, la musica elettronica e il circuit bending.
        ...
        </p>
    </div>
    <div id="sidebar">
     <img alt="una immagine di Salvatore Iaconesi"
          src="images/salvatore.png"
     <p>Salvatore Iaconesi è ingegnere robotico, artista, interaction
               designer e professore di design cross-mediale.
               </p>
    </div>
    <div id="footer">
     <ul>
         <li><a href="design.html">Design</a></li>
         <li><a href="about.html">About</a></li>
         <li><a href="blog.html">Blog</a></li>
     </ul>
     <p class="subtle">Salvatore Iaconesi, Inc.</p>
    </div>
   </div>
   </body>
   </html>
Mettiamo uno stylesheet dedicato
     <link rel="stylesheet" type="text/css"
         href="iphone.css" media="only screen and (max-width: 480px)" />
     <link rel="stylesheet" type="text/css"
         href="desktop.css" media="screen and (min-width: 481px)" />
Controlliamo viewport e scala
     <meta name="viewport" content="user-scalable=no, width=device-width" />
Creiamo look'n feel iOS in “iphone.css”
     body {
       background-color: #ddd; /* Background color */
       color: #222;         /* Foreground color used for text */
       font-family: Helvetica;
       font-size: 14px;
       margin: 0;          /* Amount of negative space around the outside of the body */
       padding: 0;          /* Amount of negative space around the inside of the body */
     }

     #header h1 {
       margin: 0;
       padding: 0;
     }
     #header h1 a {
       background-color: #ccc;
       border-bottom: 1px solid #666;
       color: #222;
       display: block;
       font-size: 20px;
       font-weight: bold;
       padding: 10px 0;
       text-align: center;
       text-decoration: none;
     }

     #header ul {
       list-style: none;
       margin: 10px;
       padding: 0;
     }
     #header ul li a {
       background-color: #FFFFFF;
       border: 1px solid #999999;
       color: #222222;
       display: block;
       font-size: 17px;
       font-weight: bold;
       margin-bottom: -1px;
       padding: 12px 10px;
       text-decoration: none;
     }

     #content, #sidebar {
       padding: 10px;
     }

     #footer {
       display: none;
     }
ANDIAMO OLTRE “iphone.css”
    #header h1 a {
      text-shadow: 0px 1px 0px #fff;
      background-image: -webkit-gradient(linear, left top, left bottom,
                           from(#ccc), to(#999));
    }




    #header ul li:first-child a {
      -webkit-border-top-left-radius: 8px;
      -webkit-border-top-right-radius: 8px;
    }
    #header ul li:last-child a {
      -webkit-border-bottom-left-radius: 8px;
      -webkit-border-bottom-right-radius: 8px;
    }
CREIAMO IL BEHAVIOUR
              Nascondiamo gli <UL> nell'#header

              #header ul.hide {
                display: none;
              }

              DEFINIAMO LO STILE PER UN PULSANTE CHE AGGIUNGEREMO
              TRA UN ATTIMO:

              #header div.leftButton {
                position: absolute;
                top: 7px;
                left: 6px;
                height: 30px;
                font-weight: bold;
                text-align: center;
                color: white;
                text-shadow: rgba(0,0,0,0.6) 0px -1px 0px;
                line-height: 28px;
                border-width: 0 8px 0 8px;
                -webkit-border-image: url(images/button.png) 0 8 0 8;
              }

              #header div.pressed {
                -webkit-border-image: url(images/buttonActive.png) 0 8 0 8;
              }

Le immagini vengono dalla directory “images” di jqtouch
CREIAMO IL BEHAVIOUR
              Aggiungiamo jQuery e predisponiamo un file per i nostri script:

              <script type="text/javascript" src="jquery.js"></script>
              <script type="text/javascript" src="iphone.js"></script>

              Dentro iphone.js aggiungiamo:

                  function jQueryStart(){
                    $('#header ul').addClass('hide');
                    $('#header').append('<div class="leftButton"
                       onclick="toggleMenu()">Menu</div>');
                  }
                  function toggleMenu() {
                    $('#header ul').toggleClass('hide');
                    $('#header .leftButton').toggleClass('pressed');
                  }

              E nella funzione onDeviceReady() aggiungiamo;

              jQueryStart();




Le immagini vengono dalla directory “images” di jqtouch
MA ANDIAMO OLTRE
UNA SEMPLICE APP GEO-REFERENZIATA

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" />
      <meta http-equiv="Content-type" content="text/html; charset=utf-8">
      <title>Beer Me</title>
      <link rel="stylesheet" href="/master.css" type="text/css" media="screen" />
      <script type="text/javascript" src="scripts/phonegap.js"></script>
      <script type="text/javascript">
          function loader() {
             var state = document.readyState;
             if (state == 'loaded' || state == 'complete') {
                  run();
             } else {
                  if (navigator.userAgent.indexOf('Browzr') > -1) {
                      setTimeout(run, 250);
                  } else {
                      document.addEventListener('deviceready',run,false);
                  }
             }
          }
          function run() {
             var win = function(position) {                     // Grab coordinates object from the Position object passed into success callback.
                  var coords = position.coords;
                  // Call for static google maps data - make sure you use your own Google Maps API key!
                  var url = "http://maps.google.com/maps/api/staticmap?center=" + coords.latitude + "," + coords.longitude + "&zoom=13&size=320x480&maptype=roadmap&key=MyGoogleMapsAPIKey&sensor=true";
                  document.getElementById('map').setAttribute('src',url);
             };
             var fail = function(e) {
                  alert('Can't retrieve position.nError: ' + e);
             };
             navigator.geolocation.getCurrentPosition(win, fail);
          }
      </script>
   </head>
   <body onload="loader();">
      <img id="map" />
   </body>
</html>
E ORA FACCIAMO UNA
APPLICAZIONE “DA ZERO” INSIEME
Salvatore Iaconesi
salvatore.iaconesi@artisopensource.net




FROM DESIGN
TO APPLICATION
Crash course per designer visuali: dal concept all'applicazione smartphone/tablet
CRASH
COURSE
COSA USEREMO


      PHONEGAP
      IOS SDK BY APPLE
      XCODE DEVELOPMENT ENVIRONMENT

      per scaricare i software:
      http://www.phonegap.com/
      http://developer.apple.com/

LE APPLICAZIONI SVILUPPATE IN QUESTO MODO POTRANNO
ESSERE IMMEDIATAMENTE PORTATE ALLA PIATTAFORMA
ANDROID (INSTALLARE AMBIENTE DI SVILUPPO ECLIPSE ED
ESEGUIRE IL TOOL DI INSTALLAZIONE APPOSITO FORNITO
INSIEME A PHONEGAP)
STEP PRELIMINARI:

1) INSTALLARE XCODE
2) INSTALLARE PHONEGAP
3) COMPILARE L'APPLICAZIONE DI DEFAULT
TUTTO OK?

PERFETTO ALLORA:


IMPARIAMO COME SI COSTRUISCE
UNA APPLICAZIONE IPHONE/IPAD
(MA ANCHE ANDROID, BLACKBERRY, WEBOS,
SYMBIAN...)




USANDO HTML5 E CSS
IMPORTANTISSIMO!

LEGGERE QUESTE GUIDELINES
IN CUI APPLE SPIEGA LE BEST PRACTICES DA
SEGUIRE IN QUESTO GENERE DI ATTIVITA'


ORA NE VEDREMO ALCUNI PASSI FONDAMENTALI
HTML + CSS GUIDELINES & BEST PRACTICES




USE STANDARDS

       HTML 4.01
       XHTML 1.0
       CSS 2.1 and partial CSS3
       ECMAScript 3 (JavaScript)
       DOM Level 2
       AJAX technologies, including XMLHttpRequest
HTML + CSS GUIDELINES & BEST PRACTICES




GOOD WEB DESIGN
PRACTICES

      USE DOCTYPE
      SEPARATE HTML E CSS FILES
      WELL STRUCTURED HTML
      USE BROWSER INDEPENDENT CODE
HTML + CSS GUIDELINES & BEST PRACTICES




USE SECURITY FEATURES


       SSL
       HTTPS
HTML + CSS GUIDELINES & BEST PRACTICES




NO FRAMESETS!
USE BLOCKS! (DIV, SPAN..)
CHECK SIZE OF WEB PAGE
HTML + CSS GUIDELINES & BEST PRACTICES




USE THE <SELECT> ELEMENT
USE ALERT, CONFIRM, PROMPT
USE HTML5 AUDIO AND VIDEO

REMEMBER DIFFERENCE BETWEEN
CLICK AND TOUCH
HTML + CSS GUIDELINES & BEST PRACTICES




 USE CONDITIONAL STYLESHEET
EXAMPLE:


SPECIFY STYLESHEET FOR IPHONE
<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">


OR, INSIDE THE CSS FILE:
@media screen and (min-device-width: 481px) { ... }
HTML + CSS GUIDELINES & BEST PRACTICES




 USE VIEWPORT
<meta name = "viewport" content = "width = device-width">

<meta name = "viewport" content = "initial-scale = 1.0">

<meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no">

<meta name = "viewport" content = "width = 590">

<meta name = "viewport" content = "user-scalable=no, width=device-width">
HTML + CSS GUIDELINES & BEST PRACTICES




 USE WEBKIT
VEDI THIS LINK PER CAPIRE LE ESTENSIONI DEL BROWSER
MOBILE DISPONIBILE SU IPHONE/IPAD

ESTENSIONI COME:

-webkit-border-image
-webkit-border-radius
-webkit-text-size-adjust
-webkit-tap-highlight-color
-webkit-animation
-webkit-mask
-webkit-transition
HTML + CSS GUIDELINES & BEST PRACTICES




FORMS
HTML + CSS GUIDELINES & BEST PRACTICES




EVENTS

 RENDERE GLI OGGETTI CLICKABLE PER
 CONTROLLARLI DA JAVASCRIPT




   <span onmouseover = "..."
     onmouseout = "..."
     onclick = "void(0)">

   WHERE TO BUY

   </span>
HTML + CSS GUIDELINES & BEST PRACTICES




 EVENTS
PER GESTIRE GLI EVENTI MULTITOUCH:

 <div                                                                       Alternatively, register handlers in JavaScript as follows:
   ontouchstart="touchStart(event);"
   ontouchmove="touchMove(event);"                                          element.addEventListener("touchstart", touchStart, false);
   ontouchend="touchEnd(event);"                                            element.addEventListener("touchmove", touchMove, false);
   ontouchcancel="touchCancel(event);"                                      element.addEventListener("touchend", touchEnd, false);
 ></div>                                                                    element.addEventListener("touchcancel", touchCancel, false);



                                                       function touchStart(event) {
                                                         // Insert your code here
                                                       }


Optionally, get all touches on a page using the touches property as follows:
                                                                                                       get the number of touches:
var allTouches = event.touches;
                                                                                                       event.touches.length

Optionally, get all touches for the target element using the targetTouches property:
                                                                                                       Get a specific touch object at index i:
var targetTouches = event.targetTouches;
                                                                                                       var touch = event.touches[i];

Optionally, get all changed touches for this event using the changedTouches property:                get the location in page coordinates for a single-finger event:

var changedTouches = event.changedTouches;                                                             var x = event.touches[0].pageX;
                                                                                                       var y = event.touches[0].pageY;
HTML + CSS GUIDELINES & BEST PRACTICES




EVENTS
MULTITOUCH + JAVASCRIPT




   function touchMove(event) {
       event.preventDefault();
       curX = event.targetTouches[0].pageX - startX;
       curY = event.targetTouches[0].pageY - startY;
       event.targetTouches[0].target.style.webkitTransform =
           'translate(' + curX + 'px, ' + curY + 'px)';
   }
HTML + CSS GUIDELINES & BEST PRACTICES




GESTURES
<div                                                               var angle = event.rotation;
  ongesturestart="gestureStart(event);"
  ongesturechange="gestureChange(event);"
  ongestureend="gestureEnd(event);"
                                                                   var scale = event.scale;
></div>



function gestureChange(event) {
  // Insert your code here
}




       onGestureChange: function(e) {
           e.preventDefault();
           e.target.style.webkitTransform =
               'scale(' + e.scale + startScale   + ') rotate(' + e.rotation + startRotation + 'deg)';
       }
INIZIAMO
PRENDIAMO UN DOCUMENTO HTML
   <html>
   <head>
    <link rel="stylesheet" href="screen.css" type="text/css" />
    <title>Salvatore Iaconesi</title>
   </head>
   <body>
   <div id="container">
    <div id="header">
     <h1><a href="./">Salvatore Iaconesi</a></h1>
     <div id="utility">
         <ul>
            <li><a href="about.html">About</a></li>
            <li><a href="blog.html">Blog</a></li>
         </ul>
     </div>
     <div id="nav">
         <ul>
            <li><a href="design.html">Design</a></li>
            <li><a href="progetti.html">Progetti</a></li>
            <li><a href="ricerca.html">Ricerca</a></li>
         </ul>
     </div>
    </div>
    <div id="content">
     <h2>About</h2>
     <p>Salvatore Iaconesi è ingegnere robotico, interaction designer
               artista e insegna cross media design alla Facoltà di
               Architettura dell'Università di Roma "La Sapienza".
               Adora gli animali, la musica elettronica e il circuit bending.
        ...
        </p>
    </div>
    <div id="sidebar">
     <img alt="una immagine di Salvatore Iaconesi"
          src="images/salvatore.png"
     <p>Salvatore Iaconesi è ingegnere robotico, artista, interaction
               designer e professore di design cross-mediale.
               </p>
    </div>
    <div id="footer">
     <ul>
         <li><a href="design.html">Design</a></li>
         <li><a href="about.html">About</a></li>
         <li><a href="blog.html">Blog</a></li>
     </ul>
     <p class="subtle">Salvatore Iaconesi, Inc.</p>
    </div>
   </div>
   </body>
   </html>
Mettiamo uno stylesheet dedicato
     <link rel="stylesheet" type="text/css"
         href="iphone.css" media="only screen and (max-width: 480px)" />
     <link rel="stylesheet" type="text/css"
         href="desktop.css" media="screen and (min-width: 481px)" />
Controlliamo viewport e scala
     <meta name="viewport" content="user-scalable=no, width=device-width" />
Creiamo look'n feel iOS in “iphone.css”
     body {
       background-color: #ddd; /* Background color */
       color: #222;         /* Foreground color used for text */
       font-family: Helvetica;
       font-size: 14px;
       margin: 0;          /* Amount of negative space around the outside of the body */
       padding: 0;          /* Amount of negative space around the inside of the body */
     }

     #header h1 {
       margin: 0;
       padding: 0;
     }
     #header h1 a {
       background-color: #ccc;
       border-bottom: 1px solid #666;
       color: #222;
       display: block;
       font-size: 20px;
       font-weight: bold;
       padding: 10px 0;
       text-align: center;
       text-decoration: none;
     }

     #header ul {
       list-style: none;
       margin: 10px;
       padding: 0;
     }
     #header ul li a {
       background-color: #FFFFFF;
       border: 1px solid #999999;
       color: #222222;
       display: block;
       font-size: 17px;
       font-weight: bold;
       margin-bottom: -1px;
       padding: 12px 10px;
       text-decoration: none;
     }

     #content, #sidebar {
       padding: 10px;
     }

     #footer {
       display: none;
     }
ANDIAMO OLTRE “iphone.css”
    #header h1 a {
      text-shadow: 0px 1px 0px #fff;
      background-image: -webkit-gradient(linear, left top, left bottom,
                           from(#ccc), to(#999));
    }




    #header ul li:first-child a {
      -webkit-border-top-left-radius: 8px;
      -webkit-border-top-right-radius: 8px;
    }
    #header ul li:last-child a {
      -webkit-border-bottom-left-radius: 8px;
      -webkit-border-bottom-right-radius: 8px;
    }
CREIAMO IL BEHAVIOUR
              Nascondiamo gli <UL> nell'#header

              #header ul.hide {
                display: none;
              }

              DEFINIAMO LO STILE PER UN PULSANTE CHE AGGIUNGEREMO
              TRA UN ATTIMO:

              #header div.leftButton {
                position: absolute;
                top: 7px;
                left: 6px;
                height: 30px;
                font-weight: bold;
                text-align: center;
                color: white;
                text-shadow: rgba(0,0,0,0.6) 0px -1px 0px;
                line-height: 28px;
                border-width: 0 8px 0 8px;
                -webkit-border-image: url(images/button.png) 0 8 0 8;
              }

              #header div.pressed {
                -webkit-border-image: url(images/buttonActive.png) 0 8 0 8;
              }

Le immagini vengono dalla directory “images” di jqtouch
CREIAMO IL BEHAVIOUR
              Aggiungiamo jQuery e predisponiamo un file per i nostri script:

              <script type="text/javascript" src="jquery.js"></script>
              <script type="text/javascript" src="iphone.js"></script>

              Dentro iphone.js aggiungiamo:

                  function jQueryStart(){
                    $('#header ul').addClass('hide');
                    $('#header').append('<div class="leftButton"
                       onclick="toggleMenu()">Menu</div>');
                  }
                  function toggleMenu() {
                    $('#header ul').toggleClass('hide');
                    $('#header .leftButton').toggleClass('pressed');
                  }

              E nella funzione onDeviceReady() aggiungiamo;

              jQueryStart();




Le immagini vengono dalla directory “images” di jqtouch
MA ANDIAMO OLTRE
UNA SEMPLICE APP GEO-REFERENZIATA

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" />
      <meta http-equiv="Content-type" content="text/html; charset=utf-8">
      <title>Beer Me</title>
      <link rel="stylesheet" href="/master.css" type="text/css" media="screen" />
      <script type="text/javascript" src="scripts/phonegap.js"></script>
      <script type="text/javascript">
          function loader() {
             var state = document.readyState;
             if (state == 'loaded' || state == 'complete') {
                  run();
             } else {
                  if (navigator.userAgent.indexOf('Browzr') > -1) {
                       setTimeout(run, 250);
                  } else {
                       document.addEventListener('deviceready',run,false);
                  }
             }
          }
          function run() {
             var win = function(position) {                      // Grab coordinates object from the Position object passed into success callback.
                  var coords = position.coords;
                  // Call for static google maps data - make sure you use your own Google Maps API key!
                  var url = "http://maps.google.com/maps/api/staticmap?center=" + coords.latitude + "," + coords.longitude + "&zoom=13&size=320x480&maptype=roadmap&key=MyGoogleMapsAPIKey&sensor=true";
                  document.getElementById('map').setAttribute('src',url);
             };
             var fail = function(e) {
                  alert('Can't retrieve position.nError: ' + e);
             };
             navigator.geolocation.getCurrentPosition(win, fail);
          }
      </script>
   </head>
   <body onload="loader();">
      <img id="map" />
   </body>
</html>
E ORA FACCIAMO UNA
APPLICAZIONE “DA ZERO” INSIEME

Weitere ähnliche Inhalte

Was ist angesagt?

Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautifulchicagonewsonlineradio
 
Blog skins396734
Blog skins396734Blog skins396734
Blog skins396734pantangmrny
 
What your testtool doesn't tell you
What your testtool doesn't tell youWhat your testtool doesn't tell you
What your testtool doesn't tell youAnnemarie Klaassen
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsPeter-Paul Koch
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQueryPaul Bakaus
 
The rise and fall of a techno DJ, plus more new reviews and notable screenings
The rise and fall of a techno DJ, plus more new reviews and notable screeningsThe rise and fall of a techno DJ, plus more new reviews and notable screenings
The rise and fall of a techno DJ, plus more new reviews and notable screeningschicagonewsyesterday
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
 
ILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseRené Winkelmeyer
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScriptShahDhruv21
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todaygerbille
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreRemy Sharp
 
Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fabio Akita
 
WordPress-Templates mit Twig erstellen - PHPUGFFM
WordPress-Templates mit Twig erstellen - PHPUGFFMWordPress-Templates mit Twig erstellen - PHPUGFFM
WordPress-Templates mit Twig erstellen - PHPUGFFMWalter Ebert
 

Was ist angesagt? (20)

Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
 
Blog skins396734
Blog skins396734Blog skins396734
Blog skins396734
 
What your testtool doesn't tell you
What your testtool doesn't tell youWhat your testtool doesn't tell you
What your testtool doesn't tell you
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript Events
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQuery
 
The rise and fall of a techno DJ, plus more new reviews and notable screenings
The rise and fall of a techno DJ, plus more new reviews and notable screeningsThe rise and fall of a techno DJ, plus more new reviews and notable screenings
The rise and fall of a techno DJ, plus more new reviews and notable screenings
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
ILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterprise
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
Blockly
BlocklyBlockly
Blockly
 
Moustamera
MoustameraMoustamera
Moustamera
 
Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009
 
WordPress-Templates mit Twig erstellen - PHPUGFFM
WordPress-Templates mit Twig erstellen - PHPUGFFMWordPress-Templates mit Twig erstellen - PHPUGFFM
WordPress-Templates mit Twig erstellen - PHPUGFFM
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
YUI 3
YUI 3YUI 3
YUI 3
 

Andere mochten auch

The Groundbreaking Revolution in Mobile App Development
The Groundbreaking Revolution in Mobile App DevelopmentThe Groundbreaking Revolution in Mobile App Development
The Groundbreaking Revolution in Mobile App DevelopmenthSenid Mobile Marketing
 
The Future of HTML5 Motion Design
 The Future of HTML5 Motion Design The Future of HTML5 Motion Design
The Future of HTML5 Motion DesignTerry Ryan
 
HTML Design for Devices
HTML Design for DevicesHTML Design for Devices
HTML Design for DevicesTerry Ryan
 
The Users are Restless
The Users are RestlessThe Users are Restless
The Users are RestlessTerry Ryan
 
Skip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildSkip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildTerry Ryan
 
Making the Mobile Web Work
Making the Mobile Web WorkMaking the Mobile Web Work
Making the Mobile Web WorkTerry Ryan
 
Master Exhibit & Public Design, La Sapienza, Lezione 1
Master Exhibit & Public Design, La Sapienza, Lezione 1Master Exhibit & Public Design, La Sapienza, Lezione 1
Master Exhibit & Public Design, La Sapienza, Lezione 1Salvatore Iaconesi
 

Andere mochten auch (7)

The Groundbreaking Revolution in Mobile App Development
The Groundbreaking Revolution in Mobile App DevelopmentThe Groundbreaking Revolution in Mobile App Development
The Groundbreaking Revolution in Mobile App Development
 
The Future of HTML5 Motion Design
 The Future of HTML5 Motion Design The Future of HTML5 Motion Design
The Future of HTML5 Motion Design
 
HTML Design for Devices
HTML Design for DevicesHTML Design for Devices
HTML Design for Devices
 
The Users are Restless
The Users are RestlessThe Users are Restless
The Users are Restless
 
Skip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildSkip the IDE with PhoneGap Build
Skip the IDE with PhoneGap Build
 
Making the Mobile Web Work
Making the Mobile Web WorkMaking the Mobile Web Work
Making the Mobile Web Work
 
Master Exhibit & Public Design, La Sapienza, Lezione 1
Master Exhibit & Public Design, La Sapienza, Lezione 1Master Exhibit & Public Design, La Sapienza, Lezione 1
Master Exhibit & Public Design, La Sapienza, Lezione 1
 

Ähnlich wie Sperimentazioni lezione6 from_designtoapplication copy

Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Patrick Lauke
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
Mobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScriptMobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScriptfranksvalli
 
Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Patrick Lauke
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind
 
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...Patrick Lauke
 
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1rit2011
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesJames Pearce
 
The Future of Responsive Design Standards
The Future of Responsive Design StandardsThe Future of Responsive Design Standards
The Future of Responsive Design StandardsBrian Fegan
 
How to use lekhoniya.pdf
How to use lekhoniya.pdfHow to use lekhoniya.pdf
How to use lekhoniya.pdfSubhamMandal40
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchJames Pearce
 
What’s new in WinJS? Windows Phone 8.1 and the road ahead
What’s new in WinJS? Windows Phone 8.1 and the road aheadWhat’s new in WinJS? Windows Phone 8.1 and the road ahead
What’s new in WinJS? Windows Phone 8.1 and the road aheadNguyên Phạm
 
Building a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchBuilding a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchJames Pearce
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flexdanielwanja
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
 

Ähnlich wie Sperimentazioni lezione6 from_designtoapplication copy (20)

Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
 
Learning Svelte
Learning SvelteLearning Svelte
Learning Svelte
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
Mobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScriptMobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScript
 
Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011
 
Client Web
Client WebClient Web
Client Web
 
Ajax-Tutorial
Ajax-TutorialAjax-Tutorial
Ajax-Tutorial
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
Смартфоны и планшетники - mobile-friendly веб-разработка помимо десктопа - RI...
 
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
смартфоны и планшетники. веб разработка помимо десктопа. Patrick h. lauke. зал 1
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutes
 
The Future of Responsive Design Standards
The Future of Responsive Design StandardsThe Future of Responsive Design Standards
The Future of Responsive Design Standards
 
How to use lekhoniya.pdf
How to use lekhoniya.pdfHow to use lekhoniya.pdf
How to use lekhoniya.pdf
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
 
What’s new in WinJS? Windows Phone 8.1 and the road ahead
What’s new in WinJS? Windows Phone 8.1 and the road aheadWhat’s new in WinJS? Windows Phone 8.1 and the road ahead
What’s new in WinJS? Windows Phone 8.1 and the road ahead
 
Mobile Web Design Code
Mobile Web Design CodeMobile Web Design Code
Mobile Web Design Code
 
Building a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchBuilding a Mobile App with Sencha Touch
Building a Mobile App with Sencha Touch
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 

Mehr von Salvatore Iaconesi

Innovation and Trangression: exploring Third Spaces and Excess Spaces
Innovation and Trangression: exploring Third Spaces and Excess SpacesInnovation and Trangression: exploring Third Spaces and Excess Spaces
Innovation and Trangression: exploring Third Spaces and Excess SpacesSalvatore Iaconesi
 
Third Infoscape, presented at DIS2017 in Edinburgh
Third Infoscape, presented at DIS2017 in EdinburghThird Infoscape, presented at DIS2017 in Edinburgh
Third Infoscape, presented at DIS2017 in EdinburghSalvatore Iaconesi
 
La Cura: Erbe Indisciplinate, ricapitolazione
La Cura: Erbe Indisciplinate, ricapitolazioneLa Cura: Erbe Indisciplinate, ricapitolazione
La Cura: Erbe Indisciplinate, ricapitolazioneSalvatore Iaconesi
 
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frame
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frameLa Cura, Erbe Indisciplinate, presentazione di benvenuto, frame
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frameSalvatore Iaconesi
 
Human Ecosystems and the Ubiquitous Commons at the STARTS program meeting
Human Ecosystems and the Ubiquitous Commons at the STARTS program meetingHuman Ecosystems and the Ubiquitous Commons at the STARTS program meeting
Human Ecosystems and the Ubiquitous Commons at the STARTS program meetingSalvatore Iaconesi
 
Ubiquitous Commons at NetFutures 2015
Ubiquitous Commons at NetFutures 2015Ubiquitous Commons at NetFutures 2015
Ubiquitous Commons at NetFutures 2015Salvatore Iaconesi
 
Near Future Design class at Isia Design: Transmedia narratives
Near Future Design class at Isia Design: Transmedia narratives Near Future Design class at Isia Design: Transmedia narratives
Near Future Design class at Isia Design: Transmedia narratives Salvatore Iaconesi
 
Ubiquitous Commons workshop at transmediale 2015, Capture All
Ubiquitous Commons workshop at transmediale 2015, Capture AllUbiquitous Commons workshop at transmediale 2015, Capture All
Ubiquitous Commons workshop at transmediale 2015, Capture AllSalvatore Iaconesi
 
Informazione Ubiqua: come è fatto un museo ubiquo?
Informazione Ubiqua: come è fatto un museo ubiquo?Informazione Ubiqua: come è fatto un museo ubiquo?
Informazione Ubiqua: come è fatto un museo ubiquo?Salvatore Iaconesi
 
Art is Open Source at Visualize: materials and links
Art is Open Source at Visualize: materials and linksArt is Open Source at Visualize: materials and links
Art is Open Source at Visualize: materials and linksSalvatore Iaconesi
 
Near Future Design: the performance of infinite futures
Near Future Design: the performance of infinite futuresNear Future Design: the performance of infinite futures
Near Future Design: the performance of infinite futuresSalvatore Iaconesi
 
Incautious Porn, SSN2014 Presentation in Barcelona
Incautious Porn, SSN2014 Presentation in BarcelonaIncautious Porn, SSN2014 Presentation in Barcelona
Incautious Porn, SSN2014 Presentation in BarcelonaSalvatore Iaconesi
 
Near Future Design - ISIA 6 Marzo 2014
Near Future Design - ISIA 6 Marzo 2014Near Future Design - ISIA 6 Marzo 2014
Near Future Design - ISIA 6 Marzo 2014Salvatore Iaconesi
 
Human Ecosystems - the relational ecosystems of cities for a new definition o...
Human Ecosystems - the relational ecosystems of cities for a new definition o...Human Ecosystems - the relational ecosystems of cities for a new definition o...
Human Ecosystems - the relational ecosystems of cities for a new definition o...Salvatore Iaconesi
 
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...Salvatore Iaconesi
 
Openness Workshop at Luiss i-Lab
Openness Workshop at Luiss i-Lab Openness Workshop at Luiss i-Lab
Openness Workshop at Luiss i-Lab Salvatore Iaconesi
 
EC(m1) the Cultural Ecosystem of Rome, at Cultur+
EC(m1) the Cultural Ecosystem of Rome, at Cultur+EC(m1) the Cultural Ecosystem of Rome, at Cultur+
EC(m1) the Cultural Ecosystem of Rome, at Cultur+Salvatore Iaconesi
 
Innovation Ecosystems at Internet Festival 2013
Innovation Ecosystems at Internet Festival 2013Innovation Ecosystems at Internet Festival 2013
Innovation Ecosystems at Internet Festival 2013Salvatore Iaconesi
 

Mehr von Salvatore Iaconesi (20)

Innovation and Trangression: exploring Third Spaces and Excess Spaces
Innovation and Trangression: exploring Third Spaces and Excess SpacesInnovation and Trangression: exploring Third Spaces and Excess Spaces
Innovation and Trangression: exploring Third Spaces and Excess Spaces
 
Third Infoscape, presented at DIS2017 in Edinburgh
Third Infoscape, presented at DIS2017 in EdinburghThird Infoscape, presented at DIS2017 in Edinburgh
Third Infoscape, presented at DIS2017 in Edinburgh
 
La Cura: Erbe Indisciplinate, ricapitolazione
La Cura: Erbe Indisciplinate, ricapitolazioneLa Cura: Erbe Indisciplinate, ricapitolazione
La Cura: Erbe Indisciplinate, ricapitolazione
 
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frame
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frameLa Cura, Erbe Indisciplinate, presentazione di benvenuto, frame
La Cura, Erbe Indisciplinate, presentazione di benvenuto, frame
 
Human Ecosystems and the Ubiquitous Commons at the STARTS program meeting
Human Ecosystems and the Ubiquitous Commons at the STARTS program meetingHuman Ecosystems and the Ubiquitous Commons at the STARTS program meeting
Human Ecosystems and the Ubiquitous Commons at the STARTS program meeting
 
Ubiquitous Commons at NetFutures 2015
Ubiquitous Commons at NetFutures 2015Ubiquitous Commons at NetFutures 2015
Ubiquitous Commons at NetFutures 2015
 
Near Future Design class at Isia Design: Transmedia narratives
Near Future Design class at Isia Design: Transmedia narratives Near Future Design class at Isia Design: Transmedia narratives
Near Future Design class at Isia Design: Transmedia narratives
 
Imaginary Brands
Imaginary BrandsImaginary Brands
Imaginary Brands
 
Ubiquitous Commons workshop at transmediale 2015, Capture All
Ubiquitous Commons workshop at transmediale 2015, Capture AllUbiquitous Commons workshop at transmediale 2015, Capture All
Ubiquitous Commons workshop at transmediale 2015, Capture All
 
Informazione Ubiqua: come è fatto un museo ubiquo?
Informazione Ubiqua: come è fatto un museo ubiquo?Informazione Ubiqua: come è fatto un museo ubiquo?
Informazione Ubiqua: come è fatto un museo ubiquo?
 
Art is Open Source at Visualize: materials and links
Art is Open Source at Visualize: materials and linksArt is Open Source at Visualize: materials and links
Art is Open Source at Visualize: materials and links
 
Near Future Design: the performance of infinite futures
Near Future Design: the performance of infinite futuresNear Future Design: the performance of infinite futures
Near Future Design: the performance of infinite futures
 
Incautious Porn, SSN2014 Presentation in Barcelona
Incautious Porn, SSN2014 Presentation in BarcelonaIncautious Porn, SSN2014 Presentation in Barcelona
Incautious Porn, SSN2014 Presentation in Barcelona
 
Near Future Design - ISIA 6 Marzo 2014
Near Future Design - ISIA 6 Marzo 2014Near Future Design - ISIA 6 Marzo 2014
Near Future Design - ISIA 6 Marzo 2014
 
Human Ecosystems - the relational ecosystems of cities for a new definition o...
Human Ecosystems - the relational ecosystems of cities for a new definition o...Human Ecosystems - the relational ecosystems of cities for a new definition o...
Human Ecosystems - the relational ecosystems of cities for a new definition o...
 
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...
La Cura: an Open Source Cure for Cancer, at Transmediale 2014: Afterglow. In ...
 
Aivot 1: a concept Library
Aivot 1: a concept LibraryAivot 1: a concept Library
Aivot 1: a concept Library
 
Openness Workshop at Luiss i-Lab
Openness Workshop at Luiss i-Lab Openness Workshop at Luiss i-Lab
Openness Workshop at Luiss i-Lab
 
EC(m1) the Cultural Ecosystem of Rome, at Cultur+
EC(m1) the Cultural Ecosystem of Rome, at Cultur+EC(m1) the Cultural Ecosystem of Rome, at Cultur+
EC(m1) the Cultural Ecosystem of Rome, at Cultur+
 
Innovation Ecosystems at Internet Festival 2013
Innovation Ecosystems at Internet Festival 2013Innovation Ecosystems at Internet Festival 2013
Innovation Ecosystems at Internet Festival 2013
 

Sperimentazioni lezione6 from_designtoapplication copy

  • 1. Salvatore Iaconesi salvatore.iaconesi@artisopensource.net FROM DESIGN TO APPLICATION Crash course per designer visuali: dal concept all'applicazione smartphone/tablet
  • 3. COSA USEREMO PHONEGAP IOS SDK BY APPLE XCODE DEVELOPMENT ENVIRONMENT per scaricare i software: http://www.phonegap.com/ http://developer.apple.com/ LE APPLICAZIONI SVILUPPATE IN QUESTO MODO POTRANNO ESSERE IMMEDIATAMENTE PORTATE ALLA PIATTAFORMA ANDROID (INSTALLARE AMBIENTE DI SVILUPPO ECLIPSE ED ESEGUIRE IL TOOL DI INSTALLAZIONE APPOSITO FORNITO INSIEME A PHONEGAP)
  • 4. STEP PRELIMINARI: 1) INSTALLARE XCODE 2) INSTALLARE PHONEGAP 3) COMPILARE L'APPLICAZIONE DI DEFAULT
  • 5. TUTTO OK? PERFETTO ALLORA: IMPARIAMO COME SI COSTRUISCE UNA APPLICAZIONE IPHONE/IPAD (MA ANCHE ANDROID, BLACKBERRY, WEBOS, SYMBIAN...) USANDO HTML5 E CSS
  • 6. IMPORTANTISSIMO! LEGGERE QUESTE GUIDELINES IN CUI APPLE SPIEGA LE BEST PRACTICES DA SEGUIRE IN QUESTO GENERE DI ATTIVITA' ORA NE VEDREMO ALCUNI PASSI FONDAMENTALI
  • 7. HTML + CSS GUIDELINES & BEST PRACTICES USE STANDARDS HTML 4.01 XHTML 1.0 CSS 2.1 and partial CSS3 ECMAScript 3 (JavaScript) DOM Level 2 AJAX technologies, including XMLHttpRequest
  • 8. HTML + CSS GUIDELINES & BEST PRACTICES GOOD WEB DESIGN PRACTICES USE DOCTYPE SEPARATE HTML E CSS FILES WELL STRUCTURED HTML USE BROWSER INDEPENDENT CODE
  • 9. HTML + CSS GUIDELINES & BEST PRACTICES USE SECURITY FEATURES SSL HTTPS
  • 10. HTML + CSS GUIDELINES & BEST PRACTICES NO FRAMESETS! USE BLOCKS! (DIV, SPAN..) CHECK SIZE OF WEB PAGE
  • 11. HTML + CSS GUIDELINES & BEST PRACTICES USE THE <SELECT> ELEMENT USE ALERT, CONFIRM, PROMPT USE HTML5 AUDIO AND VIDEO REMEMBER DIFFERENCE BETWEEN CLICK AND TOUCH
  • 12. HTML + CSS GUIDELINES & BEST PRACTICES USE CONDITIONAL STYLESHEET EXAMPLE: SPECIFY STYLESHEET FOR IPHONE <link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet"> OR, INSIDE THE CSS FILE: @media screen and (min-device-width: 481px) { ... }
  • 13. HTML + CSS GUIDELINES & BEST PRACTICES USE VIEWPORT <meta name = "viewport" content = "width = device-width"> <meta name = "viewport" content = "initial-scale = 1.0"> <meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no"> <meta name = "viewport" content = "width = 590"> <meta name = "viewport" content = "user-scalable=no, width=device-width">
  • 14. HTML + CSS GUIDELINES & BEST PRACTICES USE WEBKIT VEDI THIS LINK PER CAPIRE LE ESTENSIONI DEL BROWSER MOBILE DISPONIBILE SU IPHONE/IPAD ESTENSIONI COME: -webkit-border-image -webkit-border-radius -webkit-text-size-adjust -webkit-tap-highlight-color -webkit-animation -webkit-mask -webkit-transition
  • 15. HTML + CSS GUIDELINES & BEST PRACTICES FORMS
  • 16. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS RENDERE GLI OGGETTI CLICKABLE PER CONTROLLARLI DA JAVASCRIPT <span onmouseover = "..." onmouseout = "..." onclick = "void(0)"> WHERE TO BUY </span>
  • 17. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS PER GESTIRE GLI EVENTI MULTITOUCH: <div Alternatively, register handlers in JavaScript as follows: ontouchstart="touchStart(event);" ontouchmove="touchMove(event);" element.addEventListener("touchstart", touchStart, false); ontouchend="touchEnd(event);" element.addEventListener("touchmove", touchMove, false); ontouchcancel="touchCancel(event);" element.addEventListener("touchend", touchEnd, false); ></div> element.addEventListener("touchcancel", touchCancel, false); function touchStart(event) { // Insert your code here } Optionally, get all touches on a page using the touches property as follows: get the number of touches: var allTouches = event.touches; event.touches.length Optionally, get all touches for the target element using the targetTouches property: Get a specific touch object at index i: var targetTouches = event.targetTouches; var touch = event.touches[i]; Optionally, get all changed touches for this event using the changedTouches property: get the location in page coordinates for a single-finger event: var changedTouches = event.changedTouches; var x = event.touches[0].pageX; var y = event.touches[0].pageY;
  • 18. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS MULTITOUCH + JAVASCRIPT function touchMove(event) { event.preventDefault(); curX = event.targetTouches[0].pageX - startX; curY = event.targetTouches[0].pageY - startY; event.targetTouches[0].target.style.webkitTransform = 'translate(' + curX + 'px, ' + curY + 'px)'; }
  • 19. HTML + CSS GUIDELINES & BEST PRACTICES GESTURES <div var angle = event.rotation; ongesturestart="gestureStart(event);" ongesturechange="gestureChange(event);" ongestureend="gestureEnd(event);" var scale = event.scale; ></div> function gestureChange(event) { // Insert your code here } onGestureChange: function(e) { e.preventDefault(); e.target.style.webkitTransform = 'scale(' + e.scale + startScale + ') rotate(' + e.rotation + startRotation + 'deg)'; }
  • 21. PRENDIAMO UN DOCUMENTO HTML <html> <head> <link rel="stylesheet" href="screen.css" type="text/css" /> <title>Salvatore Iaconesi</title> </head> <body> <div id="container"> <div id="header"> <h1><a href="./">Salvatore Iaconesi</a></h1> <div id="utility"> <ul> <li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> </ul> </div> <div id="nav"> <ul> <li><a href="design.html">Design</a></li> <li><a href="progetti.html">Progetti</a></li> <li><a href="ricerca.html">Ricerca</a></li> </ul> </div> </div> <div id="content"> <h2>About</h2> <p>Salvatore Iaconesi è ingegnere robotico, interaction designer artista e insegna cross media design alla Facoltà di Architettura dell'Università di Roma "La Sapienza". Adora gli animali, la musica elettronica e il circuit bending. ... </p> </div> <div id="sidebar"> <img alt="una immagine di Salvatore Iaconesi" src="images/salvatore.png" <p>Salvatore Iaconesi è ingegnere robotico, artista, interaction designer e professore di design cross-mediale. </p> </div> <div id="footer"> <ul> <li><a href="design.html">Design</a></li> <li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> </ul> <p class="subtle">Salvatore Iaconesi, Inc.</p> </div> </div> </body> </html>
  • 22. Mettiamo uno stylesheet dedicato <link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-width: 480px)" /> <link rel="stylesheet" type="text/css" href="desktop.css" media="screen and (min-width: 481px)" />
  • 23. Controlliamo viewport e scala <meta name="viewport" content="user-scalable=no, width=device-width" />
  • 24. Creiamo look'n feel iOS in “iphone.css” body { background-color: #ddd; /* Background color */ color: #222; /* Foreground color used for text */ font-family: Helvetica; font-size: 14px; margin: 0; /* Amount of negative space around the outside of the body */ padding: 0; /* Amount of negative space around the inside of the body */ } #header h1 { margin: 0; padding: 0; } #header h1 a { background-color: #ccc; border-bottom: 1px solid #666; color: #222; display: block; font-size: 20px; font-weight: bold; padding: 10px 0; text-align: center; text-decoration: none; } #header ul { list-style: none; margin: 10px; padding: 0; } #header ul li a { background-color: #FFFFFF; border: 1px solid #999999; color: #222222; display: block; font-size: 17px; font-weight: bold; margin-bottom: -1px; padding: 12px 10px; text-decoration: none; } #content, #sidebar { padding: 10px; } #footer { display: none; }
  • 25. ANDIAMO OLTRE “iphone.css” #header h1 a { text-shadow: 0px 1px 0px #fff; background-image: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#999)); } #header ul li:first-child a { -webkit-border-top-left-radius: 8px; -webkit-border-top-right-radius: 8px; } #header ul li:last-child a { -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; }
  • 26. CREIAMO IL BEHAVIOUR Nascondiamo gli <UL> nell'#header #header ul.hide { display: none; } DEFINIAMO LO STILE PER UN PULSANTE CHE AGGIUNGEREMO TRA UN ATTIMO: #header div.leftButton { position: absolute; top: 7px; left: 6px; height: 30px; font-weight: bold; text-align: center; color: white; text-shadow: rgba(0,0,0,0.6) 0px -1px 0px; line-height: 28px; border-width: 0 8px 0 8px; -webkit-border-image: url(images/button.png) 0 8 0 8; } #header div.pressed { -webkit-border-image: url(images/buttonActive.png) 0 8 0 8; } Le immagini vengono dalla directory “images” di jqtouch
  • 27. CREIAMO IL BEHAVIOUR Aggiungiamo jQuery e predisponiamo un file per i nostri script: <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="iphone.js"></script> Dentro iphone.js aggiungiamo: function jQueryStart(){ $('#header ul').addClass('hide'); $('#header').append('<div class="leftButton" onclick="toggleMenu()">Menu</div>'); } function toggleMenu() { $('#header ul').toggleClass('hide'); $('#header .leftButton').toggleClass('pressed'); } E nella funzione onDeviceReady() aggiungiamo; jQueryStart(); Le immagini vengono dalla directory “images” di jqtouch
  • 29. UNA SEMPLICE APP GEO-REFERENZIATA <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Beer Me</title> <link rel="stylesheet" href="/master.css" type="text/css" media="screen" /> <script type="text/javascript" src="scripts/phonegap.js"></script> <script type="text/javascript"> function loader() { var state = document.readyState; if (state == 'loaded' || state == 'complete') { run(); } else { if (navigator.userAgent.indexOf('Browzr') > -1) { setTimeout(run, 250); } else { document.addEventListener('deviceready',run,false); } } } function run() { var win = function(position) { // Grab coordinates object from the Position object passed into success callback. var coords = position.coords; // Call for static google maps data - make sure you use your own Google Maps API key! var url = "http://maps.google.com/maps/api/staticmap?center=" + coords.latitude + "," + coords.longitude + "&zoom=13&size=320x480&maptype=roadmap&key=MyGoogleMapsAPIKey&sensor=true"; document.getElementById('map').setAttribute('src',url); }; var fail = function(e) { alert('Can't retrieve position.nError: ' + e); }; navigator.geolocation.getCurrentPosition(win, fail); } </script> </head> <body onload="loader();"> <img id="map" /> </body> </html>
  • 30. E ORA FACCIAMO UNA APPLICAZIONE “DA ZERO” INSIEME
  • 31. Salvatore Iaconesi salvatore.iaconesi@artisopensource.net FROM DESIGN TO APPLICATION Crash course per designer visuali: dal concept all'applicazione smartphone/tablet
  • 33. COSA USEREMO PHONEGAP IOS SDK BY APPLE XCODE DEVELOPMENT ENVIRONMENT per scaricare i software: http://www.phonegap.com/ http://developer.apple.com/ LE APPLICAZIONI SVILUPPATE IN QUESTO MODO POTRANNO ESSERE IMMEDIATAMENTE PORTATE ALLA PIATTAFORMA ANDROID (INSTALLARE AMBIENTE DI SVILUPPO ECLIPSE ED ESEGUIRE IL TOOL DI INSTALLAZIONE APPOSITO FORNITO INSIEME A PHONEGAP)
  • 34. STEP PRELIMINARI: 1) INSTALLARE XCODE 2) INSTALLARE PHONEGAP 3) COMPILARE L'APPLICAZIONE DI DEFAULT
  • 35. TUTTO OK? PERFETTO ALLORA: IMPARIAMO COME SI COSTRUISCE UNA APPLICAZIONE IPHONE/IPAD (MA ANCHE ANDROID, BLACKBERRY, WEBOS, SYMBIAN...) USANDO HTML5 E CSS
  • 36. IMPORTANTISSIMO! LEGGERE QUESTE GUIDELINES IN CUI APPLE SPIEGA LE BEST PRACTICES DA SEGUIRE IN QUESTO GENERE DI ATTIVITA' ORA NE VEDREMO ALCUNI PASSI FONDAMENTALI
  • 37. HTML + CSS GUIDELINES & BEST PRACTICES USE STANDARDS HTML 4.01 XHTML 1.0 CSS 2.1 and partial CSS3 ECMAScript 3 (JavaScript) DOM Level 2 AJAX technologies, including XMLHttpRequest
  • 38. HTML + CSS GUIDELINES & BEST PRACTICES GOOD WEB DESIGN PRACTICES USE DOCTYPE SEPARATE HTML E CSS FILES WELL STRUCTURED HTML USE BROWSER INDEPENDENT CODE
  • 39. HTML + CSS GUIDELINES & BEST PRACTICES USE SECURITY FEATURES SSL HTTPS
  • 40. HTML + CSS GUIDELINES & BEST PRACTICES NO FRAMESETS! USE BLOCKS! (DIV, SPAN..) CHECK SIZE OF WEB PAGE
  • 41. HTML + CSS GUIDELINES & BEST PRACTICES USE THE <SELECT> ELEMENT USE ALERT, CONFIRM, PROMPT USE HTML5 AUDIO AND VIDEO REMEMBER DIFFERENCE BETWEEN CLICK AND TOUCH
  • 42. HTML + CSS GUIDELINES & BEST PRACTICES USE CONDITIONAL STYLESHEET EXAMPLE: SPECIFY STYLESHEET FOR IPHONE <link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet"> OR, INSIDE THE CSS FILE: @media screen and (min-device-width: 481px) { ... }
  • 43. HTML + CSS GUIDELINES & BEST PRACTICES USE VIEWPORT <meta name = "viewport" content = "width = device-width"> <meta name = "viewport" content = "initial-scale = 1.0"> <meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no"> <meta name = "viewport" content = "width = 590"> <meta name = "viewport" content = "user-scalable=no, width=device-width">
  • 44. HTML + CSS GUIDELINES & BEST PRACTICES USE WEBKIT VEDI THIS LINK PER CAPIRE LE ESTENSIONI DEL BROWSER MOBILE DISPONIBILE SU IPHONE/IPAD ESTENSIONI COME: -webkit-border-image -webkit-border-radius -webkit-text-size-adjust -webkit-tap-highlight-color -webkit-animation -webkit-mask -webkit-transition
  • 45. HTML + CSS GUIDELINES & BEST PRACTICES FORMS
  • 46. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS RENDERE GLI OGGETTI CLICKABLE PER CONTROLLARLI DA JAVASCRIPT <span onmouseover = "..." onmouseout = "..." onclick = "void(0)"> WHERE TO BUY </span>
  • 47. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS PER GESTIRE GLI EVENTI MULTITOUCH: <div Alternatively, register handlers in JavaScript as follows: ontouchstart="touchStart(event);" ontouchmove="touchMove(event);" element.addEventListener("touchstart", touchStart, false); ontouchend="touchEnd(event);" element.addEventListener("touchmove", touchMove, false); ontouchcancel="touchCancel(event);" element.addEventListener("touchend", touchEnd, false); ></div> element.addEventListener("touchcancel", touchCancel, false); function touchStart(event) { // Insert your code here } Optionally, get all touches on a page using the touches property as follows: get the number of touches: var allTouches = event.touches; event.touches.length Optionally, get all touches for the target element using the targetTouches property: Get a specific touch object at index i: var targetTouches = event.targetTouches; var touch = event.touches[i]; Optionally, get all changed touches for this event using the changedTouches property: get the location in page coordinates for a single-finger event: var changedTouches = event.changedTouches; var x = event.touches[0].pageX; var y = event.touches[0].pageY;
  • 48. HTML + CSS GUIDELINES & BEST PRACTICES EVENTS MULTITOUCH + JAVASCRIPT function touchMove(event) { event.preventDefault(); curX = event.targetTouches[0].pageX - startX; curY = event.targetTouches[0].pageY - startY; event.targetTouches[0].target.style.webkitTransform = 'translate(' + curX + 'px, ' + curY + 'px)'; }
  • 49. HTML + CSS GUIDELINES & BEST PRACTICES GESTURES <div var angle = event.rotation; ongesturestart="gestureStart(event);" ongesturechange="gestureChange(event);" ongestureend="gestureEnd(event);" var scale = event.scale; ></div> function gestureChange(event) { // Insert your code here } onGestureChange: function(e) { e.preventDefault(); e.target.style.webkitTransform = 'scale(' + e.scale + startScale + ') rotate(' + e.rotation + startRotation + 'deg)'; }
  • 51. PRENDIAMO UN DOCUMENTO HTML <html> <head> <link rel="stylesheet" href="screen.css" type="text/css" /> <title>Salvatore Iaconesi</title> </head> <body> <div id="container"> <div id="header"> <h1><a href="./">Salvatore Iaconesi</a></h1> <div id="utility"> <ul> <li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> </ul> </div> <div id="nav"> <ul> <li><a href="design.html">Design</a></li> <li><a href="progetti.html">Progetti</a></li> <li><a href="ricerca.html">Ricerca</a></li> </ul> </div> </div> <div id="content"> <h2>About</h2> <p>Salvatore Iaconesi è ingegnere robotico, interaction designer artista e insegna cross media design alla Facoltà di Architettura dell'Università di Roma "La Sapienza". Adora gli animali, la musica elettronica e il circuit bending. ... </p> </div> <div id="sidebar"> <img alt="una immagine di Salvatore Iaconesi" src="images/salvatore.png" <p>Salvatore Iaconesi è ingegnere robotico, artista, interaction designer e professore di design cross-mediale. </p> </div> <div id="footer"> <ul> <li><a href="design.html">Design</a></li> <li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> </ul> <p class="subtle">Salvatore Iaconesi, Inc.</p> </div> </div> </body> </html>
  • 52. Mettiamo uno stylesheet dedicato <link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-width: 480px)" /> <link rel="stylesheet" type="text/css" href="desktop.css" media="screen and (min-width: 481px)" />
  • 53. Controlliamo viewport e scala <meta name="viewport" content="user-scalable=no, width=device-width" />
  • 54. Creiamo look'n feel iOS in “iphone.css” body { background-color: #ddd; /* Background color */ color: #222; /* Foreground color used for text */ font-family: Helvetica; font-size: 14px; margin: 0; /* Amount of negative space around the outside of the body */ padding: 0; /* Amount of negative space around the inside of the body */ } #header h1 { margin: 0; padding: 0; } #header h1 a { background-color: #ccc; border-bottom: 1px solid #666; color: #222; display: block; font-size: 20px; font-weight: bold; padding: 10px 0; text-align: center; text-decoration: none; } #header ul { list-style: none; margin: 10px; padding: 0; } #header ul li a { background-color: #FFFFFF; border: 1px solid #999999; color: #222222; display: block; font-size: 17px; font-weight: bold; margin-bottom: -1px; padding: 12px 10px; text-decoration: none; } #content, #sidebar { padding: 10px; } #footer { display: none; }
  • 55. ANDIAMO OLTRE “iphone.css” #header h1 a { text-shadow: 0px 1px 0px #fff; background-image: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#999)); } #header ul li:first-child a { -webkit-border-top-left-radius: 8px; -webkit-border-top-right-radius: 8px; } #header ul li:last-child a { -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; }
  • 56. CREIAMO IL BEHAVIOUR Nascondiamo gli <UL> nell'#header #header ul.hide { display: none; } DEFINIAMO LO STILE PER UN PULSANTE CHE AGGIUNGEREMO TRA UN ATTIMO: #header div.leftButton { position: absolute; top: 7px; left: 6px; height: 30px; font-weight: bold; text-align: center; color: white; text-shadow: rgba(0,0,0,0.6) 0px -1px 0px; line-height: 28px; border-width: 0 8px 0 8px; -webkit-border-image: url(images/button.png) 0 8 0 8; } #header div.pressed { -webkit-border-image: url(images/buttonActive.png) 0 8 0 8; } Le immagini vengono dalla directory “images” di jqtouch
  • 57. CREIAMO IL BEHAVIOUR Aggiungiamo jQuery e predisponiamo un file per i nostri script: <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="iphone.js"></script> Dentro iphone.js aggiungiamo: function jQueryStart(){ $('#header ul').addClass('hide'); $('#header').append('<div class="leftButton" onclick="toggleMenu()">Menu</div>'); } function toggleMenu() { $('#header ul').toggleClass('hide'); $('#header .leftButton').toggleClass('pressed'); } E nella funzione onDeviceReady() aggiungiamo; jQueryStart(); Le immagini vengono dalla directory “images” di jqtouch
  • 59. UNA SEMPLICE APP GEO-REFERENZIATA <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Beer Me</title> <link rel="stylesheet" href="/master.css" type="text/css" media="screen" /> <script type="text/javascript" src="scripts/phonegap.js"></script> <script type="text/javascript"> function loader() { var state = document.readyState; if (state == 'loaded' || state == 'complete') { run(); } else { if (navigator.userAgent.indexOf('Browzr') > -1) { setTimeout(run, 250); } else { document.addEventListener('deviceready',run,false); } } } function run() { var win = function(position) { // Grab coordinates object from the Position object passed into success callback. var coords = position.coords; // Call for static google maps data - make sure you use your own Google Maps API key! var url = "http://maps.google.com/maps/api/staticmap?center=" + coords.latitude + "," + coords.longitude + "&zoom=13&size=320x480&maptype=roadmap&key=MyGoogleMapsAPIKey&sensor=true"; document.getElementById('map').setAttribute('src',url); }; var fail = function(e) { alert('Can't retrieve position.nError: ' + e); }; navigator.geolocation.getCurrentPosition(win, fail); } </script> </head> <body onload="loader();"> <img id="map" /> </body> </html>
  • 60. E ORA FACCIAMO UNA APPLICAZIONE “DA ZERO” INSIEME