SlideShare ist ein Scribd-Unternehmen logo
1 von 155
HTML5, CSS3 and
other fancy buzzwords
   Bringing sexy back to the mobile web
What’s Up?
     Mohammad (Mo) Jangda

      batmoo@gmail.com
mohammad.jangda@vortexmobile.ca

        http://digitalize.ca
           @mjangda
HTML5
Move over Jesse James Garret!
 We've found the new AJAX!
What exactly is
an HTML5?
• HTML4 all grown up?

• xHTML's way cooler cousin?

• 5 Highly Trained Militant Lemurs?     Steve Jobs
                                      Inventor of HTML5
a bit of HTML
                +
         a dash of CSS
                +
a whole sprinkling of JavaScript
The HTML5 Family
   Semantics                    Geolocation

      Forms                          Offline

  Presentation                       Storage
        Styling
      Transforms
      Animations
                                     Web
                                    Workers
  Rich Media
        Audio
        Video                   Web Sockets
        Canvas


   Minus some legitimate & illegitimate cousins...
So what does
HTML5 give us?
Strong Semantics
  Good markup is healthy markup.
Richness without
         cost
Add all the whiz, bang, and fireworks without having to
         rely on 3rd party libraries and plugins.

Stuff that took images and extra markup and hours to
perfect, now available through a CSS property or two.
New levels of
      interactivity
APIs that help us build more powerful, feature-rich
                 mobile webapps.

 Helping bridge the gap between native and web.
What’s it mean for
 the Mobile Web?
• It's finally growing up
• WebApps are better, smarter, sexier
• WebApps can do more with less
• WebApps can do the same, if not more
  than Native Apps
<audio> &
 <video>
<video src=“movie.mp4” />

       <audio src=“sound.wav” />




                  Simple
CODE
<video width=”320” height=”240” poster=”poster.png”>
         <source src="video.m4v" type='video/mp4; codecs="avc1.42E01E,
       mp4a.40.2"' />
         <source src="video.webm" type='video/webm; codecs="vp8,
       vorbis"' />
         <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"' /
       >
         <object>
            <!-- Add Flash fallback here -->
            <!-- Be nice to really dumb devices -->
            <p>Download the <a href="video.mp4">video</a></p>
         </object>
       </video>
CODE




                                     Advanced
Desktops have all the fun!
Player is customizable and programmatically accessible
        through javascript (i.e. play, pause, etc.)

           Not the case on mobile devices
                   (iPad excluded)
Most devices
 offload audio and
 video playback to
their native media
players...which is a
         good thing
Oh, and support kinda sucks...

              YAUFW!
       (Yet Another Unnecessary Format War)
CSS3 Styling
<div class="qzForm roundedcornr_box_812460">
       
    <div class="roundedcornr_top_812460">
       
    
       <div></div>
       
    </div>
       
    <div class="roundedcornr_content_812460">
       
    
       Your content goes here!
       
    </div>
         <div class="roundedcornr_bottom_812460">
       
    
       <div></div>
         </div>
       </div>

       <style>
       
    /* Rounded corner for registration tab */
         .roundedcornr_box_812460 {
       
       background: url(../images/rounded/roundedcornr_812460_tl.png) no-repeat top left;
         }
         .roundedcornr_top_812460 {
       
       background: url(../images/rounded/roundedcornr_812460_tr.png) no-repeat top right;
         }
         .roundedcornr_bottom_812460 {
       
       background: url(../images/rounded/roundedcornr_812460_bl.png) no-repeat bottom left;
         }
         .roundedcornr_bottom_812460 div {
       
       background: url(../images/rounded/roundedcornr_812460_br.png) no-repeat bottom right;
         }
         .roundedcornr_content_812460 {
       
       background: url(../images/rounded/roundedcornr_812460_r.png) top right repeat-y;
         }

         .roundedcornr_top_812460 div,.roundedcornr_top_812460,
         .roundedcornr_bottom_812460 div, .roundedcornr_bottom_812460 {
       
      width: 100%;
       
      height: 15px;
       
      font-size: 1px;
         }
         .roundedcornr_content_812460, .roundedcornr_bottom_812460 {
       
      /*margin-top: -19px;*/
         }
CODE




         .roundedcornr_content_812460 { padding: 0 15px; }
       </style>




       Pre-CSS3: Rounded Corners
<div class=“rounded”>
         
 This is content
         </div>

         <style type=“text/css”>
         
 .rounded {
         
 
   border-radius: 5px;
         
 
   border: 1px solid #111;
         
 }
         </style>
CODE




       CSS3: Rounded Corners
Amazing!
Yes, we just went from 3 billion lines of code...


              ...to just under 10.
Some of the fancy new properties:
 Rounded corners:
 border-radius

 Drop shadows:
 box-shadow & text-shadow

 Multiple columns:
 column-count & column-gap

 Transparent backgrounds:
 rgba

 Multiple backgrounds

 Background gradients
Because CSS3 is not yet a finalized
spec, base properties don’t work in
          most browsers.

   Instead, you have to use the
proprietary prefix for each browser.
-moz-border-radius (for Fennec / FF)

                -o-border-radius (for Opera Mobile)
border-radius
                -webkit-border-radius (in Mobile
                Safari, Android, webOS, BB6)

                -ms-border-radius (in IE Mobile)
CSS3 Selectors
Full of sizzle-y goodness.
       Well, close enough.
Attribute pattern-matching

         starts with
    [rel^=”awesome”]

          ends with
    [title$=”amazing”]

        contains
    [name*=”super”]
Element matching

                  nth-child
nth-child(odd)   nth-child(2)   nth-child(2n)

               nth-last-child
same as above, except working backwards

                     not
                 :not(input)


       and a whole bunch of others...
CSS3 Transforms
#Box1




Meet Mr. Box.
#B
                  ox
                     1

         Feelin’ Tipsy, Mr. Box?

#Box1 {
  transform: rotate(45deg);
}
#Box1
                #Box1




      Feelin’ Out of Place, Mr. Box?

#Box1 {
  transform: translate(10px, 10px);
}
#Box1
                  #Box1




 Feelin’ (Vertically) Out of Place, Mr. Box?

#Box1 {
  transform: translateY(10px);
}
#Box1
                     #Box1




Feelin’ (Horizontally) Out of Place, Mr. Box?

#Box1 {
  transform: translateX(10px);
}
#Box1




 Feelin’ a little bloated, Mr. Box?

#Box1 {
  transform: scale(2);
}
#Box1




     Feelin’ weak, Mr. Box?

#Box1 {
  transform: scale(0.5);
}
#Box1


                                                   #Box1




How’s the weather up there, Mr. Box?       Ate too much, Mr. Box?

 #Box1 {                               #Box1 {
   transform: scaleY(2);                 transform: scaleX(2);
 }                                     }
View (a)skew , Mr. Box?

#Box1 {
  transform: skew(-30deg, 30deg);
}
What about those cool 3D
transforms in Toy Story?
    iPhone-only at this point.
     (though, possibly BlackBerry 6 as well)
Transform in Z-space using Z properties.


                   scaleZ
                  rotateZ
                 rotate3D
                translateZ
Are images dead?
     Unlikely.
CSS3 Transition &
   Animation
JavaScript animations on mobile
       devices are painful.
 Like first-crush-ditching-you-
for-your-best-friend-because-
 he-has-a-newer-bike painful.
CSS animations are smoother,
faster, and require far less code.

And just for kicks, we’ll throw in
some hardware acceleration too.
As simple as adding a single
         property!



         transition: 1s;
Whenever a property for the transition-ready
element changes, the browser auto-tweens the
              element for you!
#container {
  transition: 1s;
}

#container:hover {
  opacity: 0.4
}
Transition Properties

Which properties should be animated?
    transition-property: color;
                      default: all


 How long should the transition take?
      transition-duration: 1s;
        default: 0, which means no animation.
                       Required!


 Should we wait a bit before starting?
       transition-delay: 0.5s;
                      default: 0
    Can be negative. Will start as if pre-animated.
Transition Properties (cont’d)

  Which timing curve should we use?
transition-timing-function: ease-out;
                 default: ease

                Other values:

                      linear
                     ease-in
                    ease-out
                  ease-in-out
         cubic-bezier (custom-defined)
CODE
Feeling lazy? Shorthand it.
Feeling lazy? Shorthand it.



p{
  transition: color 1s ease-in 2s;
}
Feeling lazy? Shorthand it.



p{
  transition: color 1s ease-in 2s;
}



Might change to:

p{
  transition: color 1s/2s ease-in;
}
Want to make everything transition-ready?
             (though, probably a bad idea)
Want to make everything transition-ready?
                  (though, probably a bad idea)




        *{
             transition: 1s;
        }
Whenever possible, use classes instead of
      direct CSS manipulation.
Whenever possible, use classes instead of
      direct CSS manipulation.

    Generally yields better performance.
What about complex animations?

  Combine multiple transitions!
Define tween checkpoints and the
properties to be changed at each.
Define tween checkpoints and the
properties to be changed at each.
#box1.animated {
  animation-name: goCrazy
}


@keyframes goCrazy {
  0% {

  }
  33% {
     left: 200px;
  }
  66% {
    -webkit-transform: rotate(-90deg);
  }

 100% {
     -webkit-transform: scale(2);
     opacity: 0;
  }
}
Animation Properties


          Same as before
      animation-duration: 1s;
       animation-delay: 0.5s;
animation-timing-function: ease-out;

Which direction should animations run?
  animation-direction: alternate;
                 default: normal;

Which direction should animations run?
   animation-iteration-count: 4;
                    default: 1;
       Use infinite for a never-ending loop.
Let’s walk through a simple 3D
          animation...
#Box1                            #Box2




         Remember Mr. Box?
        Say Hello to Mrs. Box.
#Box1                          #Box2




        Let’s get animating!
#Box1
#Box1   2xoB#
#Box1       2xoB#




        Flip horizontally
#Box1                 2xoB#




                  Flip horizontally

        transform: rotateY(180deg);
#Box1   2xoB#
#Box1   2xoB#
#xoB#
2Box1
#Container




  #xoB#
  2Box1
#Container




       #xoB#
       2Box1




Re-position and wrap
#Container




          #xoB#
          2Box1




   Re-position and wrap

position: absolute;
position: relative;



       #Container




          #xoB#
          2Box1




   Re-position and wrap

position: absolute;
position: relative;



       #Container




          #xoB#
          2Box1




   Re-position and wrap

position: absolute;
#Container




  #Box1
  2 xoB
#Container




      #Box1
      2 xoB




Enable 3D animation
#Container




                #Box1
                2 xoB




          Enable 3D animation

#container {
  transform-style: preserve-3d;
  transition: transform 1s;
}
#Container




  #Box1
  2 xoB
reniatnoC#




               1xoB#
               #Box2




             Get flippy

#container:hover {
  transform: rotateY(180deg);
}
#Container




  #Box1
  2 xoB
#container.flipped {
             transform: rotateY(180deg);
           }



<div id=”container” onclick=”this.className = ‘flipped’”>
...
</div>
Because :hover and mobile don’t always get along...




           #container.flipped {
             transform: rotateY(180deg);
           }



<div id=”container” onclick=”this.className = ‘flipped’”>
...
</div>
http://www.paulrhayes.com/experiments/cube-3d/
                   index.html
Canvas
Exactly what it sounds
A blank slate with which you can do (almost) anything:

- create elements, shapes, lines, images, 3D things, text.
- modify them
- animate them
- etc.
Geolocation
if (navigator.geolocation) {
       
 navigator.geolocation.getCurrentPosition(success, error);
       } else {
       
 alert('Your device doesn't support HTML5 geolocation');
       }
CODE
function success( position ) {
       
 alert( 'Latitude: ' + position.coords.latitude );
       
 alert( 'Longitude: ' + position.coords.longitude );
       
 // position exposes other properties as well:
       
 // timestamp, accuracy, heading, altitude, etc.
       }
CODE
function error( error ) {
       
 alert( 'Sorry, we could’nt figure out your location!' );
       
 console.error( 'Error', error.code, error.message );
       
 // error codes:
       
 // 1: location permission denied
       
 // 2: location fetch failed
       
 // 3: timeout
       
 // 0: unknown
       }
CODE
Not quite stalker-ish enough for you?
if(navigator.geolocation) {
       
 watch = navigator.geolocation.watchPosition( success );
       
 // Callback triggered whenever position changes
       
 // Success callback could add a point to a map
       
 // Or refresh a list of nearby locations
       
 // Etc.
       }




       // Stop stalking
       clearWatch(watch);
CODE
Users always have to allow access
      to their location first.
Stalking Best Practices
         Always provide a fallback!

               IP location can suck.

GPSes are awesome, but satellites can have bad days.

 Have an [edit location] button AND manual entry
So, what can we do
  with Location?
Let’s Map It
<div id="map">
           </div>

           <script src="http://maps.google.com/maps/api/js?sensor=false"></script>

           <script>
           function initMap(id) {
           
 var mapOptions = {
       
           center: new google.maps.LatLng(0, 0),
       
           zoom: 15,
       
           mapTypeId: google.maps.MapTypeId.ROADMAP
       
        };

               return new google.maps.Map(document.getElementById(id), mapOptions);
           }
       
       
       var map = initMap('map');
       
       
       </script>
CODE




                                            Initialize the map
<script>
         function mapPosition(map, lat, lng) {
         
 var position = new google.maps.LatLng(lat, lng);
       
       markerOptions = {
                position: position,
                map: map
            };
            var marker = new google.maps.Marker(markerOptions);
            map.setCenter(position);
            return marker;
       
    }
       
    
       
    if(navigator.geolocation) {
       
    
 navigator.geolocation.getCurrentPosition(
                function( position ) {
                   mapPosition(map,
                                   position.coords.latitude,
                                   position.coords.longitude
                                   );
                },
                function( error ) {
                   alert(error.message);
                }
            );
       
    }
CODE




       
         </script>

                                  Add User’s Location to the map
Let’s Geocode It.
http://maps.google.com/maps/api/geocode/json?
       latlng=40.714224,-73.961452&sensor=false
CODE




                        Server-side (need proxy)
new   google.maps.Geocoder();
       
     geocoder.geocode( {
       
     
 
    'latLng': new google.maps.LatLng(lat, lng)
       
     
 },
       
     
 function(results, status) {
       
     
 
    for( var i = 0; i < data.results.length; i++ ) {
       
     
 
    
    var result = results[i];
       
     
 
    
    if(result.types[0] == 'locality' && result.types[1] == 'political') {
       
     
 
    
    
    alert('Your city: ' + result.formatted_address);
       
     
 
    
    }
       
     
 
    }
       
     
 }
       
     );
CODE




                                                        Client-side
Connect with any of the 3 trillion
 Location-based APIs out there.
Offline
Manifest                         Storage
Cache for storing HTML, CSS, JS     Cache for storing data.
  required for offline usage.             3 flavours:

                                        sessionStorage
                                         localStorage
                                          Web SQL

                                  (and a few other types being
                                   cooked up for the future...)
Beyond just for "I'm going
      underground" scenarios.
Pre-loading of content improves speed and prevents
           repeated roundtrips to server.

Cache heavy or unique data loads that are unlikely to
  change, e.g. location information, favourites, etc.
Specify the manifest file
       <!DOCTYPE HTML>
       <html manifest="offline-manifest">




       offline-manifest file



       CACHE MANIFEST
       index.html
       help.html
       style/main.css
       images/logo.png
       images/cupcakes.png
CODE
sessionStorage.haveMessage = true;

           localStorage.messages = [
Window 1      ‘Hello World’
              , ‘Goodbye World’
           ]




Window 2
sessionStorage.haveMessage
           => true
Window 1   localStorage.messages
           => [ ‘Hello World’, ‘Goodbye World’ ]




           sessionStorage.haveMessage
           => null
Window 2   localStorage.messages
           => [ ‘Hello World’, ‘Goodbye World’ ]
Web SQL
Full-fledged SQLLite database in the browser!
// Basic API methods

       db = openDatabase( name, version );

       db.transaction( callback );

       transaction.executeSql( sql, values, success, error );
CODE
// Create database connection
       // @params: name, version, display name, size in bytes
       var db = openDatabase('bakery', '1.0', 'My Bakery', 1048576);
CODE
// Create table
       db.transaction(function(trans) {
           trans.executeSql('CREATE TABLE IF NOT EXISTS Cupcakes (name TEXT,
       description TEXT)', []);
       });
CODE
// Add entries
       db.transaction(function(trans) {
       
 trans.executeSql('INSERT INTO Cupcakes VALUES (?, ?)', ['Vanilla', 'Good ol vanilla!']);
           trans.executeSql('INSERT INTO Cupcakes VALUES (?, ?)', ['Chocolate', 'Good ol chocolate!']);
       });
CODE
// Select entries
       db.transaction(function(trans) {
       
    trans.executeSql(‘SELECT * FROM Cupcakes’, [], function(trans, results) {
       
    
        for(var i = 0; i < results.rows.length; i++) {
       
    
        
       var cupcake = results.rows.item(i);
       
    
        
       document.getElement('cupcakes').innerHTML += '<li>' + cupcake.name + ':</strong> ' + cucpake.description + '</li>';
       
    
        }
       
    
        alert('We've got ' + results.rows.length + ' cupcake(s)');
       
    });
       });
CODE
sessionStorage
      vs.
 localStorage
      vs.
   Web SQL
Depends on the specificity
and complexity of your use
         cases.
          sessionStorage: Cupcake
         localStorage: Slice of cake
       Web SQL: Multi-tiered wedding cake




(Though, the last two can vary depending on your views on SQL / noSQL)
Storage in the Wild
Gmail Web SQL database
Recent messages are pre-fetched. Certain data (labels) is pre-fetched.
                Requires force refresh for update.
YouTube localStorage
Caches AJAX requests, search history, user actions, etc.
Sundry Cool Stuff
         #1
         window.onhashchange / pushState

Build true event-driven, dyanmic sites with solid back
         button support and fragement urls.
Sundry Cool Stuff
       #2
               data-attributes

Store data as attributes within DOM Elements.
<a data-flavour=”chocolate”>Cupcake!</a>

       (Accessed via element.dataset.flavour => chocolate)
CODE
Use Case: Weather WebApp
Get User Location
        (geolocation)

    Store Favourite Cities
        (localStorage)

 Pre-fetch long-term forecast
         (Web SQL)

   Weather Trends Graphs
         (Canvas)

         Eye Candy
(CSS3 transitions / animations)

    Video Weather Report
          (<video>)
Tools of the Trade
Because only nerds build everything from scratch.
iUI
jQTouch
SenchaTouch
SproutCore
jQuery Mobile
Numerous other libraries
                processing.js
                  raphael.js
        geolocation (with fallbacks)
    jQuery.animate + CSS3 Animations
   persistence.js (with fallback to Gears)
And, one more thing:
      Enhance
   Progressively!
What’s Next?
   Hardware access?
    Notifications?
    Mind control?
Thank You!
       Mohammad Jangda
         Vortex Mobile

      batmoo@gmail.com
mohammad.jangda@vortexmobile.ca

        http://digitalize.ca
           @mjangda

Weitere ähnliche Inhalte

Andere mochten auch

Quality Manager Position
Quality Manager PositionQuality Manager Position
Quality Manager PositionMarni Sampair
 
Nous reptes a la web 20
Nous reptes a la web 20Nous reptes a la web 20
Nous reptes a la web 20Nuria Alart
 
Neil's Birthday Present
Neil's Birthday PresentNeil's Birthday Present
Neil's Birthday Presentecksteins
 
Max Glutathione Study
Max Glutathione StudyMax Glutathione Study
Max Glutathione StudyMark Royer
 
Scaling in the cloud mswebcafe
Scaling in the cloud mswebcafeScaling in the cloud mswebcafe
Scaling in the cloud mswebcafeCombell NV
 
Im aula competencial
Im aula competencialIm aula competencial
Im aula competencialNuria Alart
 
powerpoint Layouts for reuse
powerpoint Layouts for reusepowerpoint Layouts for reuse
powerpoint Layouts for reusebarcelona99
 
The Tragic Story of Mohenjo-Daro
The Tragic Story of Mohenjo-DaroThe Tragic Story of Mohenjo-Daro
The Tragic Story of Mohenjo-DaroMrs. McCabe
 
Love Again, Or Never Love
Love Again, Or Never LoveLove Again, Or Never Love
Love Again, Or Never LoveMrs. McCabe
 
World Cultures. 114
World Cultures. 114World Cultures. 114
World Cultures. 114Mrs. McCabe
 
World Cultures Flower Presentation 171
World Cultures Flower Presentation  171World Cultures Flower Presentation  171
World Cultures Flower Presentation 171Mrs. McCabe
 
Hosting tot Cloud Syntra West
Hosting tot Cloud Syntra WestHosting tot Cloud Syntra West
Hosting tot Cloud Syntra WestCombell NV
 

Andere mochten auch (20)

Key terms novel unit
Key terms novel unitKey terms novel unit
Key terms novel unit
 
Paris
ParisParis
Paris
 
Quality Manager Position
Quality Manager PositionQuality Manager Position
Quality Manager Position
 
Nous reptes a la web 20
Nous reptes a la web 20Nous reptes a la web 20
Nous reptes a la web 20
 
Neil's Birthday Present
Neil's Birthday PresentNeil's Birthday Present
Neil's Birthday Present
 
Max Glutathione Study
Max Glutathione StudyMax Glutathione Study
Max Glutathione Study
 
Cafè amb web
Cafè amb webCafè amb web
Cafè amb web
 
Scaling in the cloud mswebcafe
Scaling in the cloud mswebcafeScaling in the cloud mswebcafe
Scaling in the cloud mswebcafe
 
Im aula competencial
Im aula competencialIm aula competencial
Im aula competencial
 
Putfoot Rally
Putfoot RallyPutfoot Rally
Putfoot Rally
 
powerpoint Layouts for reuse
powerpoint Layouts for reusepowerpoint Layouts for reuse
powerpoint Layouts for reuse
 
The Tragic Story of Mohenjo-Daro
The Tragic Story of Mohenjo-DaroThe Tragic Story of Mohenjo-Daro
The Tragic Story of Mohenjo-Daro
 
Love Again, Or Never Love
Love Again, Or Never LoveLove Again, Or Never Love
Love Again, Or Never Love
 
shoes by 139
shoes by 139shoes by 139
shoes by 139
 
story
storystory
story
 
World Cultures. 114
World Cultures. 114World Cultures. 114
World Cultures. 114
 
World Cultures Flower Presentation 171
World Cultures Flower Presentation  171World Cultures Flower Presentation  171
World Cultures Flower Presentation 171
 
Hosting tot Cloud Syntra West
Hosting tot Cloud Syntra WestHosting tot Cloud Syntra West
Hosting tot Cloud Syntra West
 
Animals by:164
Animals by:164Animals by:164
Animals by:164
 
Cars
CarsCars
Cars
 

Ähnlich wie HTML5, CSS3, and other fancy buzzwords

CSS3: Ready for Primetime?
CSS3: Ready for Primetime?CSS3: Ready for Primetime?
CSS3: Ready for Primetime?Jeff Bridgforth
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryAndrea Verlicchi
 
Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleErin M. Kidwell
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopShoshi Roberts
 
Add Some Awesome-Sauce
Add Some Awesome-SauceAdd Some Awesome-Sauce
Add Some Awesome-Saucedavist11
 
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Anna Migas
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not FlashThomas Fuchs
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Codemotion
 
Mistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhoneMistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhonekentbrew
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperWynn Netherland
 
HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well Anna Migas
 
Modernizr - Detecting HTML5 and CSS3 support
Modernizr - Detecting HTML5 and CSS3 supportModernizr - Detecting HTML5 and CSS3 support
Modernizr - Detecting HTML5 and CSS3 supportPaul Irish
 

Ähnlich wie HTML5, CSS3, and other fancy buzzwords (20)

CSS3: Ready for Primetime?
CSS3: Ready for Primetime?CSS3: Ready for Primetime?
CSS3: Ready for Primetime?
 
Css3 101
Css3 101Css3 101
Css3 101
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQuery
 
Css3
Css3Css3
Css3
 
Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddle
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Add Some Awesome-Sauce
Add Some Awesome-SauceAdd Some Awesome-Sauce
Add Some Awesome-Sauce
 
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
Mistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhoneMistakes I Made Building Netflix for the iPhone
Mistakes I Made Building Netflix for the iPhone
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
 
HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well
 
Modernizr - Detecting HTML5 and CSS3 support
Modernizr - Detecting HTML5 and CSS3 supportModernizr - Detecting HTML5 and CSS3 support
Modernizr - Detecting HTML5 and CSS3 support
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
Css3
Css3Css3
Css3
 
Hardboiled Web Design
Hardboiled Web DesignHardboiled Web Design
Hardboiled Web Design
 

Kürzlich hochgeladen

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Kürzlich hochgeladen (20)

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

HTML5, CSS3, and other fancy buzzwords

  • 1. HTML5, CSS3 and other fancy buzzwords Bringing sexy back to the mobile web
  • 2. What’s Up? Mohammad (Mo) Jangda batmoo@gmail.com mohammad.jangda@vortexmobile.ca http://digitalize.ca @mjangda
  • 3. HTML5 Move over Jesse James Garret! We've found the new AJAX!
  • 4. What exactly is an HTML5? • HTML4 all grown up? • xHTML's way cooler cousin? • 5 Highly Trained Militant Lemurs? Steve Jobs Inventor of HTML5
  • 5. a bit of HTML + a dash of CSS + a whole sprinkling of JavaScript
  • 6. The HTML5 Family Semantics Geolocation Forms Offline Presentation Storage Styling Transforms Animations Web Workers Rich Media Audio Video Web Sockets Canvas Minus some legitimate & illegitimate cousins...
  • 8. Strong Semantics Good markup is healthy markup.
  • 9. Richness without cost Add all the whiz, bang, and fireworks without having to rely on 3rd party libraries and plugins. Stuff that took images and extra markup and hours to perfect, now available through a CSS property or two.
  • 10. New levels of interactivity APIs that help us build more powerful, feature-rich mobile webapps. Helping bridge the gap between native and web.
  • 11. What’s it mean for the Mobile Web?
  • 12. • It's finally growing up • WebApps are better, smarter, sexier • WebApps can do more with less • WebApps can do the same, if not more than Native Apps
  • 13.
  • 15. <video src=“movie.mp4” /> <audio src=“sound.wav” /> Simple CODE
  • 16. <video width=”320” height=”240” poster=”poster.png”> <source src="video.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /> <source src="video.webm" type='video/webm; codecs="vp8, vorbis"' /> <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"' / > <object> <!-- Add Flash fallback here --> <!-- Be nice to really dumb devices --> <p>Download the <a href="video.mp4">video</a></p> </object> </video> CODE Advanced
  • 17. Desktops have all the fun! Player is customizable and programmatically accessible through javascript (i.e. play, pause, etc.) Not the case on mobile devices (iPad excluded)
  • 18. Most devices offload audio and video playback to their native media players...which is a good thing
  • 19. Oh, and support kinda sucks... YAUFW! (Yet Another Unnecessary Format War)
  • 21. <div class="qzForm roundedcornr_box_812460"> <div class="roundedcornr_top_812460"> <div></div> </div> <div class="roundedcornr_content_812460"> Your content goes here! </div> <div class="roundedcornr_bottom_812460"> <div></div> </div> </div> <style> /* Rounded corner for registration tab */ .roundedcornr_box_812460 { background: url(../images/rounded/roundedcornr_812460_tl.png) no-repeat top left; } .roundedcornr_top_812460 { background: url(../images/rounded/roundedcornr_812460_tr.png) no-repeat top right; } .roundedcornr_bottom_812460 { background: url(../images/rounded/roundedcornr_812460_bl.png) no-repeat bottom left; } .roundedcornr_bottom_812460 div { background: url(../images/rounded/roundedcornr_812460_br.png) no-repeat bottom right; } .roundedcornr_content_812460 { background: url(../images/rounded/roundedcornr_812460_r.png) top right repeat-y; } .roundedcornr_top_812460 div,.roundedcornr_top_812460, .roundedcornr_bottom_812460 div, .roundedcornr_bottom_812460 { width: 100%; height: 15px; font-size: 1px; } .roundedcornr_content_812460, .roundedcornr_bottom_812460 { /*margin-top: -19px;*/ } CODE .roundedcornr_content_812460 { padding: 0 15px; } </style> Pre-CSS3: Rounded Corners
  • 22. <div class=“rounded”> This is content </div> <style type=“text/css”> .rounded { border-radius: 5px; border: 1px solid #111; } </style> CODE CSS3: Rounded Corners
  • 23. Amazing! Yes, we just went from 3 billion lines of code... ...to just under 10.
  • 24. Some of the fancy new properties: Rounded corners: border-radius Drop shadows: box-shadow & text-shadow Multiple columns: column-count & column-gap Transparent backgrounds: rgba Multiple backgrounds Background gradients
  • 25. Because CSS3 is not yet a finalized spec, base properties don’t work in most browsers. Instead, you have to use the proprietary prefix for each browser.
  • 26. -moz-border-radius (for Fennec / FF) -o-border-radius (for Opera Mobile) border-radius -webkit-border-radius (in Mobile Safari, Android, webOS, BB6) -ms-border-radius (in IE Mobile)
  • 28. Full of sizzle-y goodness. Well, close enough.
  • 29. Attribute pattern-matching starts with [rel^=”awesome”] ends with [title$=”amazing”] contains [name*=”super”]
  • 30. Element matching nth-child nth-child(odd) nth-child(2) nth-child(2n) nth-last-child same as above, except working backwards not :not(input) and a whole bunch of others...
  • 33. #B ox 1 Feelin’ Tipsy, Mr. Box? #Box1 { transform: rotate(45deg); }
  • 34. #Box1 #Box1 Feelin’ Out of Place, Mr. Box? #Box1 { transform: translate(10px, 10px); }
  • 35. #Box1 #Box1 Feelin’ (Vertically) Out of Place, Mr. Box? #Box1 { transform: translateY(10px); }
  • 36. #Box1 #Box1 Feelin’ (Horizontally) Out of Place, Mr. Box? #Box1 { transform: translateX(10px); }
  • 37. #Box1 Feelin’ a little bloated, Mr. Box? #Box1 { transform: scale(2); }
  • 38. #Box1 Feelin’ weak, Mr. Box? #Box1 { transform: scale(0.5); }
  • 39. #Box1 #Box1 How’s the weather up there, Mr. Box? Ate too much, Mr. Box? #Box1 { #Box1 { transform: scaleY(2); transform: scaleX(2); } }
  • 40. View (a)skew , Mr. Box? #Box1 { transform: skew(-30deg, 30deg); }
  • 41. What about those cool 3D transforms in Toy Story? iPhone-only at this point. (though, possibly BlackBerry 6 as well)
  • 42. Transform in Z-space using Z properties. scaleZ rotateZ rotate3D translateZ
  • 43. Are images dead? Unlikely.
  • 44. CSS3 Transition & Animation
  • 45. JavaScript animations on mobile devices are painful. Like first-crush-ditching-you- for-your-best-friend-because- he-has-a-newer-bike painful.
  • 46. CSS animations are smoother, faster, and require far less code. And just for kicks, we’ll throw in some hardware acceleration too.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55. As simple as adding a single property! transition: 1s;
  • 56. Whenever a property for the transition-ready element changes, the browser auto-tweens the element for you!
  • 57.
  • 58.
  • 59. #container { transition: 1s; } #container:hover { opacity: 0.4 }
  • 60. Transition Properties Which properties should be animated? transition-property: color; default: all How long should the transition take? transition-duration: 1s; default: 0, which means no animation. Required! Should we wait a bit before starting? transition-delay: 0.5s; default: 0 Can be negative. Will start as if pre-animated.
  • 61. Transition Properties (cont’d) Which timing curve should we use? transition-timing-function: ease-out; default: ease Other values: linear ease-in ease-out ease-in-out cubic-bezier (custom-defined)
  • 62. CODE
  • 64. Feeling lazy? Shorthand it. p{ transition: color 1s ease-in 2s; }
  • 65. Feeling lazy? Shorthand it. p{ transition: color 1s ease-in 2s; } Might change to: p{ transition: color 1s/2s ease-in; }
  • 66. Want to make everything transition-ready? (though, probably a bad idea)
  • 67. Want to make everything transition-ready? (though, probably a bad idea) *{ transition: 1s; }
  • 68. Whenever possible, use classes instead of direct CSS manipulation.
  • 69. Whenever possible, use classes instead of direct CSS manipulation. Generally yields better performance.
  • 70. What about complex animations? Combine multiple transitions!
  • 71.
  • 72.
  • 73. Define tween checkpoints and the properties to be changed at each.
  • 74. Define tween checkpoints and the properties to be changed at each. #box1.animated { animation-name: goCrazy } @keyframes goCrazy { 0% { } 33% { left: 200px; } 66% { -webkit-transform: rotate(-90deg); } 100% { -webkit-transform: scale(2); opacity: 0; } }
  • 75. Animation Properties Same as before animation-duration: 1s; animation-delay: 0.5s; animation-timing-function: ease-out; Which direction should animations run? animation-direction: alternate; default: normal; Which direction should animations run? animation-iteration-count: 4; default: 1; Use infinite for a never-ending loop.
  • 76. Let’s walk through a simple 3D animation...
  • 77.
  • 78.
  • 79.
  • 80. #Box1 #Box2 Remember Mr. Box? Say Hello to Mrs. Box.
  • 81. #Box1 #Box2 Let’s get animating!
  • 82. #Box1
  • 83. #Box1 2xoB#
  • 84. #Box1 2xoB# Flip horizontally
  • 85. #Box1 2xoB# Flip horizontally transform: rotateY(180deg);
  • 86. #Box1 2xoB#
  • 87. #Box1 2xoB#
  • 90. #Container #xoB# 2Box1 Re-position and wrap
  • 91. #Container #xoB# 2Box1 Re-position and wrap position: absolute;
  • 92. position: relative; #Container #xoB# 2Box1 Re-position and wrap position: absolute;
  • 93. position: relative; #Container #xoB# 2Box1 Re-position and wrap position: absolute;
  • 95. #Container #Box1 2 xoB Enable 3D animation
  • 96. #Container #Box1 2 xoB Enable 3D animation #container { transform-style: preserve-3d; transition: transform 1s; }
  • 98. reniatnoC# 1xoB# #Box2 Get flippy #container:hover { transform: rotateY(180deg); }
  • 100. #container.flipped { transform: rotateY(180deg); } <div id=”container” onclick=”this.className = ‘flipped’”> ... </div>
  • 101. Because :hover and mobile don’t always get along... #container.flipped { transform: rotateY(180deg); } <div id=”container” onclick=”this.className = ‘flipped’”> ... </div>
  • 103. Canvas
  • 104. Exactly what it sounds A blank slate with which you can do (almost) anything: - create elements, shapes, lines, images, 3D things, text. - modify them - animate them - etc.
  • 105.
  • 106.
  • 108. if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success, error); } else { alert('Your device doesn't support HTML5 geolocation'); } CODE
  • 109. function success( position ) { alert( 'Latitude: ' + position.coords.latitude ); alert( 'Longitude: ' + position.coords.longitude ); // position exposes other properties as well: // timestamp, accuracy, heading, altitude, etc. } CODE
  • 110. function error( error ) { alert( 'Sorry, we could’nt figure out your location!' ); console.error( 'Error', error.code, error.message ); // error codes: // 1: location permission denied // 2: location fetch failed // 3: timeout // 0: unknown } CODE
  • 111. Not quite stalker-ish enough for you?
  • 112. if(navigator.geolocation) { watch = navigator.geolocation.watchPosition( success ); // Callback triggered whenever position changes // Success callback could add a point to a map // Or refresh a list of nearby locations // Etc. } // Stop stalking clearWatch(watch); CODE
  • 113. Users always have to allow access to their location first.
  • 114. Stalking Best Practices Always provide a fallback! IP location can suck. GPSes are awesome, but satellites can have bad days. Have an [edit location] button AND manual entry
  • 115. So, what can we do with Location?
  • 117. <div id="map"> </div> <script src="http://maps.google.com/maps/api/js?sensor=false"></script> <script> function initMap(id) { var mapOptions = { center: new google.maps.LatLng(0, 0), zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; return new google.maps.Map(document.getElementById(id), mapOptions); } var map = initMap('map'); </script> CODE Initialize the map
  • 118. <script> function mapPosition(map, lat, lng) { var position = new google.maps.LatLng(lat, lng); markerOptions = { position: position, map: map }; var marker = new google.maps.Marker(markerOptions); map.setCenter(position); return marker; } if(navigator.geolocation) { navigator.geolocation.getCurrentPosition( function( position ) { mapPosition(map, position.coords.latitude, position.coords.longitude ); }, function( error ) { alert(error.message); } ); } CODE </script> Add User’s Location to the map
  • 119.
  • 121. http://maps.google.com/maps/api/geocode/json? latlng=40.714224,-73.961452&sensor=false CODE Server-side (need proxy)
  • 122. new google.maps.Geocoder(); geocoder.geocode( { 'latLng': new google.maps.LatLng(lat, lng) }, function(results, status) { for( var i = 0; i < data.results.length; i++ ) { var result = results[i]; if(result.types[0] == 'locality' && result.types[1] == 'political') { alert('Your city: ' + result.formatted_address); } } } ); CODE Client-side
  • 123. Connect with any of the 3 trillion Location-based APIs out there.
  • 125. Manifest Storage Cache for storing HTML, CSS, JS Cache for storing data. required for offline usage. 3 flavours: sessionStorage localStorage Web SQL (and a few other types being cooked up for the future...)
  • 126. Beyond just for "I'm going underground" scenarios. Pre-loading of content improves speed and prevents repeated roundtrips to server. Cache heavy or unique data loads that are unlikely to change, e.g. location information, favourites, etc.
  • 127. Specify the manifest file <!DOCTYPE HTML> <html manifest="offline-manifest"> offline-manifest file CACHE MANIFEST index.html help.html style/main.css images/logo.png images/cupcakes.png CODE
  • 128. sessionStorage.haveMessage = true; localStorage.messages = [ Window 1 ‘Hello World’ , ‘Goodbye World’ ] Window 2
  • 129. sessionStorage.haveMessage => true Window 1 localStorage.messages => [ ‘Hello World’, ‘Goodbye World’ ] sessionStorage.haveMessage => null Window 2 localStorage.messages => [ ‘Hello World’, ‘Goodbye World’ ]
  • 130. Web SQL Full-fledged SQLLite database in the browser!
  • 131. // Basic API methods db = openDatabase( name, version ); db.transaction( callback ); transaction.executeSql( sql, values, success, error ); CODE
  • 132. // Create database connection // @params: name, version, display name, size in bytes var db = openDatabase('bakery', '1.0', 'My Bakery', 1048576); CODE
  • 133. // Create table db.transaction(function(trans) { trans.executeSql('CREATE TABLE IF NOT EXISTS Cupcakes (name TEXT, description TEXT)', []); }); CODE
  • 134. // Add entries db.transaction(function(trans) { trans.executeSql('INSERT INTO Cupcakes VALUES (?, ?)', ['Vanilla', 'Good ol vanilla!']); trans.executeSql('INSERT INTO Cupcakes VALUES (?, ?)', ['Chocolate', 'Good ol chocolate!']); }); CODE
  • 135. // Select entries db.transaction(function(trans) { trans.executeSql(‘SELECT * FROM Cupcakes’, [], function(trans, results) { for(var i = 0; i < results.rows.length; i++) { var cupcake = results.rows.item(i); document.getElement('cupcakes').innerHTML += '<li>' + cupcake.name + ':</strong> ' + cucpake.description + '</li>'; } alert('We've got ' + results.rows.length + ' cupcake(s)'); }); }); CODE
  • 136. sessionStorage vs. localStorage vs. Web SQL
  • 137. Depends on the specificity and complexity of your use cases. sessionStorage: Cupcake localStorage: Slice of cake Web SQL: Multi-tiered wedding cake (Though, the last two can vary depending on your views on SQL / noSQL)
  • 138. Storage in the Wild
  • 139. Gmail Web SQL database Recent messages are pre-fetched. Certain data (labels) is pre-fetched. Requires force refresh for update.
  • 140. YouTube localStorage Caches AJAX requests, search history, user actions, etc.
  • 141. Sundry Cool Stuff #1 window.onhashchange / pushState Build true event-driven, dyanmic sites with solid back button support and fragement urls.
  • 142. Sundry Cool Stuff #2 data-attributes Store data as attributes within DOM Elements.
  • 143. <a data-flavour=”chocolate”>Cupcake!</a> (Accessed via element.dataset.flavour => chocolate) CODE
  • 144. Use Case: Weather WebApp
  • 145. Get User Location (geolocation) Store Favourite Cities (localStorage) Pre-fetch long-term forecast (Web SQL) Weather Trends Graphs (Canvas) Eye Candy (CSS3 transitions / animations) Video Weather Report (<video>)
  • 146. Tools of the Trade Because only nerds build everything from scratch.
  • 147. iUI
  • 152. Numerous other libraries processing.js raphael.js geolocation (with fallbacks) jQuery.animate + CSS3 Animations persistence.js (with fallback to Gears)
  • 153. And, one more thing: Enhance Progressively!
  • 154. What’s Next? Hardware access? Notifications? Mind control?
  • 155. Thank You! Mohammad Jangda Vortex Mobile batmoo@gmail.com mohammad.jangda@vortexmobile.ca http://digitalize.ca @mjangda

Hinweis der Redaktion

  1. (Note: I&apos;ve omitted some APIs, since they&apos;re not relevant or not yet prime-time ready)
  2. In context of mobile, can mean the difference between a happy user and a hate mail user
  3. Optimized for playback and Usability (big buttons) (ever try using a Flash-based player with the teeniest of controls -- no offense Adobe) It makes for a bit of a jagged UX
  4. Images are dead Okay, no. Pure CSS graphics? I&apos;d say we&apos;re far from seeing that
  5. matrix property = [a, b, c, d]
  6. Though, tools coming out that will help make the process far easier.
  7. Set z-index as well
  8. Set z-index as well
  9. Set z-index as well
  10. Set z-index as well
  11. Set z-index as well
  12. Set z-index as well
  13. Set z-index as well
  14. Traditional user flows for location based apps Enter City or Postal Code ---&gt; Narrow Down Choices ---&gt; Done &amp;#xA0;&amp;#xA0; &amp;#xA0; (City -- long name) &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; (5 choices) &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0; &amp;#xA0;(done) &amp;#xA0;&amp;#xA0; &amp;#xA0; (Postal Code --- wrong format) &amp;#xA0; (&quot;Did you mean?&quot;) &amp;#xA0; &amp;#xA0; (done) Cut that down to two simple clicks
  15. Work similar to XHR requests --- Specify callbacks --- Have to wait for the location in some instances (if the GPS is slow)
  16. Caveat: WatchLocation stops when screen times out Though, I&amp;#x2019;ve heard (but not tested) that web workers can get around this
  17. Once allowed though, most devices remember the allow and won&amp;#x2019;t prompt the user again.
  18. The one key thing needed to enable offline Just a file that tells the browser what to cache Browser serves up cached content when user&apos;s connection is offline What about navigator.onLine / navigator.offLine ? Supported, but Google thinks otherwise
  19. sessionStorage is window-specific localStorage is browser-specific Standard key-value store&amp;#xA0;
  20. Processing.js -&gt; Canvas Wrappers for geolocation (with fallback to Google IP geolocation) CSS3 animation / transition support etc