SlideShare a Scribd company logo
講師:Jollen Chen <jollen@jollen.org>
          Blog:http://www.jollen.org/blog
          課程:http://www.moko365.com

          課程專案:鴻海科技集團贊助課程
          課程名稱:⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關(2)
          課程⽇日期:2013/1/24 (四)
          課程時間:10:00~17:00
          講義版本:v1.3.0




         八屏一雲時代來臨	 
    教你HTML5六小時打通關(2)
Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                       1
http://www.moko365.com/enterprise/html5-app-javascript-frontend

                                                                  2
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》



                              LICENSE NOTICE
          This work is licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License.

You are free:
 •   to Share — to copy, distribute and transmit the work
 •   to make commercial use of the work

Under the following conditions:
 •   Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any
     way that suggests that they endorse you or your use of the work).
 •   No Derivative Works — You may not alter, transform, or build upon this work.

With the understanding that:

 • Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
 • Public Domain — Where the work or any of its elements is in the public domain under applicable law, that
   status is in no way affected by the license.
 • Other Rights — In no way are any of the following rights affected by the license:
  ◦ Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
  ◦ The author's moral rights;
  ◦ Rights other persons may have either in the work itself or in how the work is used, such as publicity or
     privacy rights.
 • Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The
   best way to do this is with a link to this web page.



 Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                                  3
使用	 JavaScript	 製作動畫:
                                    使用	 GreenSock

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                       4
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                              GreenSock




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        5
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                       GSAP
       GreenSock Animation Platform (GSAP)

       使⽤用 JavaScript




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        6
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                               Tool Suite
       TweenLite

       TweenMax

       TimelineLite

       TimelineMax




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        7
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                              Crazy Fast




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        8
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                關於 JavaScript 效能
       在上⼀一堂課所介紹的觀念,效能由瀏覽器引擎的品質決定

       在多媒體應⽤用⽅方⾯面,好的 Browser engine + 好的 JavaScript
       animation library,開始有能⼒力取代傳統的 Native 實作⽅方法




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        9
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                               使⽤用 GSAP
       官⽅方⼊入⾨門教學

      ➡    http://www.greensock.com/jump-start-js/

       可單獨執⾏行

      ➡    無須搭配其它 JavaScript 平臺 (eg. jQuery)

       可與 jQuery 搭配使⽤用

      ➡    建議只將 jQuery 做為 selector

      ➡    不使⽤用 jQuery 的 animation 功能




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        10
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                          使⽤用 TweenLite

<!--- The following scripts are necessary to do TweenLite tweens on CSS properties -->
<script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script>
<script type="text/javascript" src="js/greensock/TweenLite.min.js"></script>




 Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                         11
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


   第⼀一個 GSAP 程式 (TweenLite)
           logo 元素將以 1 秒的時間,擁有⼀一個 CSS property {left:632px}
                                   tween




        <script>
        window.onload = function(){
           var logo = document.getElementById("logo");
           TweenLite.to(logo, 1, {css:{left:"632px"}});
        }
        </script>




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              12
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                             TweenLite.to()

TweenLite.to( [target object], [duration in seconds], [destination values] )




Source: http://www.greensock.com

   Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                               13
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           Scale & Opacity
              <div id="demo">
                 <div class="box" id="red"></div>
                 <div class="box" id="yellow"></div>
                 <div class="box" id="green"></div>
              </div>




                        var red = document.getElementById("red"),
                          yellow = document.getElementById("yellow"),
                          green = document.getElementById("green");

                        TweenLite.to([red, yellow, green], 1, {css:{scale:0.2, opacity:0.3}});
                                       (JavaScript array)




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                 14
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                    Use jQuery Selector
              <div id="demo">
                 <div class="box" id="red"></div>
                 <div class="box" id="yellow"></div>
                 <div class="box" id="green"></div>
              </div>




            var red = document.getElementById("red"),
              yellow = document.getElementById("yellow"),
              green = document.getElementById("green");


            TweenLite.to($(".box"), 1, {css:{scale:0.2, opacity:0.3}});


                            jQuery Selector




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                          15
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           Event Callbacks
           onStart

           onUpdate

           onComplete

           onReverse

           onReverseComplete




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              16
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                    Use Event Callbacks
 var logo = document.getElementById("logo"),
   updateOutput = document.getElementById("updateOutput"),
   completeOutput = document.getElementById("completeOutput"),
   updateCount = 0;


 TweenLite.to(logo, 2, {css:{left:"300px"},
   onUpdate:updateHandler,
   onComplete:completeHandler,
   onCompleteParams:["animation complete!"]});

 function updateHandler() {
   updateCount++;
   updateOutput.innerHTML = "onUpdate fired " + updateCount;
 }


 function completeHandler(message) {
   completeOutput.innerHTML = "onComplete fired <br/> completeParams = " + message;
 }



Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                     17
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                         Control Playback
           play(), play(5)

           pause()

           resume()

           reverse(), reverse(1)

           seek(), seek(3)

           timeScale(), timeScale(0.5), timeScale(2)

           restart()



Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              18
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                              使⽤用 EasePack

 <!--- loading easePack because the tween uses a Linear ease -->
 <script type="text/javascript" src="js/greensock/easing/EasePack.min.js"></script>


 <script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script>
 <script type="text/javascript" src="js/greensock/TweenLite.min.js"></script>




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                        19
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Call restart() Method
          <div id="demo">
             <div id="logo"></div>
          </div>
          <input type="button" id="restartBtn" value="restart animation">




          var logo = document.getElementById("logo"),
            restartBtn = document.getElementById("restartBtn"),
            tween = TweenLite.to(logo, 1, {css:{left:"632px"}});


          restartBtn.onclick = function() {
             tween.restart();
          }



Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                            20
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                   TweenMax
           從 TweenLite 升級到 TweenMax

           更多的 Animation 功能

           並⽀支援許多 plugins

         ➡    CSSPlugin

         ➡    BezierPlugin

         ➡    RoundPropsPlugin




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              21
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           使⽤用 TweenMax

     <!-- TweenMax includes TweenLite, TimelineLite, TimelineMax, EasePack, RoundPropsPlugin
     and CSSPlugin -->


     <script type="text/javascript" src="js/greensock/TweenMax.min.js"></script>




     var logo = document.getElementById("logo");
     TweenMax.to(logo, 1, {css:{left:"300px"}, repeat:3, yoyo:true});

                                               set repeat   Tween will smoothly reverse direction
                                                            each time it repeats




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                    22
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                   使⽤用 Stagger
           staggerTo()

           staggerFrom()




Source: http://www.greensock.com

  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              23
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


            Call staggerTo() Method
     <div id="demo">
       <div class="box" id="red"></div>
       <div class="box" id="yellow"></div>
       <div class="box" id="green"></div>
        <div class="box" id="blue"></div>
        <div class="box" id="pink"></div>
        <div class="box" id="purple"></div>
     </div>




var red = document.getElementById("red"),
  yellow = document.getElementById("yellow"),
  green = document.getElementById("green"),
                                                                               The fourth parameter called stagger sets the
  blue = document.getElementById("blue"),
                                                                               amount of time that will transpire between the
  pink = document.getElementById("pink"),                                      start of each animation.
  purple = document.getElementById("purple");

//The last parameter with value of .25 is the stagger amount. Try changing it to 1 see how it impacts the animation.
TweenMax.staggerTo([red, yellow, green, blue, pink, purple], 1, {css:{scale:0.2, opacity:0.3}}, 0.25);



Source: http://www.greensock.com Inc. All Rights Reserved.
  Copyright (C) 2013 Moko365

                                                                                                                                24
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           TimelineLite
       建⽴立⼀一系列的動畫效果 (animation sequences)

       使⽤用 TimelineLite 的實例來儲存多個動畫 ( thousands of
       animations)

       將多個動畫群組化 (group)

       並視為 single tween 來控制

       可將 playback control 使⽤用於 Timeline 群組




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        25
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                        實例化 TimelineLite
<script>
$(window).load(function() {
  var logo = $("#logo"),
     timelineLite = $("#timelinelite"),
     tagline = $("#tagline span"),
     restartBtn = $("#restartBtn"),
     tl = new TimelineLite(); // Timeline 的實例化

     tl.from(logo, 0.5, {css:{left:"-=60px"}, ease:Back.easeOut})
       .from(timelinelite, 0.5, {css:{width:"0px", alpha:0}}, -0.02)
       .staggerFrom(tagline, 0.5, {css:{top:"-=30px", rotation:"-40deg", alpha:0, scale:1.8}, ease:Back.easeOut}, 0.2);


  restartBtn.click(function() {
      tl.restart();
  });

  //show the demoBackground div after DOM is ready and all images loaded
  TweenLite.set($("#demoBackground"), {css:{visibility:"visible"}});
});
 </script>



  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                                          26
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


            使⽤用 TimelineLite Lables
           加⼊入 lables 以做為導覽列 (navigation)


tl.append("skew") // adds a new label
 .append(getSkewAnimation()) // method returns a TimelineLite instance that gets nested at the end
 .append(getStaggerAnimation(), "stagger") //creates new label and adds animation there
 .append(getParticlesAnimation(), "particles")




  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                     27
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                             TimelineMax
       如同 TweenLite 與 TweenMax 的關係

       TimelineMax 可⽀支援

      ➡    set repeat

      ➡    yoyo

      ➡    currentLabel()

      ➡    getLabelAfter()

      ➡    getLablesArray()

      ➡    tweenFromTo()




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                           28
多屏	 Layout	 &	 CSS	 定義:
                             Adaptive	 CSS	 Framework

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                        29
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Less Framework 4




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        30
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                  課程回顧




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        31
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                  adapt.js
       前次課程使⽤用

       替代 CSS Media Query

      ➡    有瀏覽器相容性問題

       Less Framework 4 是⽐比 adapt.js 更重量級的⼯工具




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        32
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           使⽤用 adapt.js
    <script>
    var ADAPT_CONFIG = {
     path: 'css/',

         dynamic: true,


         range: [
          '0px to 480px = 480.css',
          '480px to 600px = 600.css',
             '600px to 720px = 720.css',
             '720px to 800px = 800.css'
         ]
    };
    </script>
    <script src="./adapt.js"></script>
Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                         33
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


           認識 Less Framework 4
        CSS grid system

        For designing adaptive websites

        4 layouts

        3 sets of typography presets

        基於 Media Query 技術

        Permissive license (MIT license)

        ⽀支援 Retina Media Query *


 Source: http://lessframework.com


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                           34
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                               4 Layouts




Source: http://lessframework.com
Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                         35
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


          使⽤用 Less Framework 4




Source: http://lessframework.com
Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                         36
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                       技術⾯面
       有對基礎的 element 做 reset

      ➡    html, body, div, span ...

       沒有對不同的瀏覽器與裝置做 “base”

      ➡    請參考第⼀一堂課介紹

      ➡    Cross browser and cross devices

       使⽤用 “px” 較不合適

      ➡    請參考第⼀一堂課介紹

      ➡    改⽤用 “rem” 等較合適的單位




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        37
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


      技術細節:使⽤用 Media Query
/*         Wide Mobile Layout: 480px.
           Gutters: 24px.
           Outer margins: 22px.
           Inherits styles from: Default Layout, Mobile Layout.
------------------------------------------------------------
cols       1    2  3   4  5
px         68   160 252 344              436      */


@media only screen and (min-width: 480px) and (max-width: 767px) {


       body {
          width: 436px;
          padding: 36px 22px 48px;
       }


}
    Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                     38
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


技術細節:Retina Media Query
/*   Retina media query.
     Overrides styles for devices with a
     device-pixel-ratio of 2+, such as iPhone 4.
----------------------------------------------- */


@media
  only screen and (-webkit-min-device-pixel-ratio: 2),
     only screen and (min-device-pixel-ratio: 2) {


     body {


     }




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                         39
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                        總結
       使⽤用 Media Query 做為⼋八屏的基本技術

       不需從新寫起,但要了解其原理 (第⼀一堂課)

       使⽤用現有的 UI Framework (如 Less Framework 4)

       以 Less Framework 4 為例,有些⼋八屏 (cross devices) 的技術細節
       未考慮到




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                           40
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                        Less+ Framework




Source: http://www.angrycreative.se/wordpress/plugins/less-framework/


   Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                        41
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


           簡介 Less+ Framework
       Less+ Framework is a cross-device CSS grid system using
       media queries

       Less Framework 4 的⼀一個擴充插件

       改⽤用 jQuery Media Query

      ➡    取代 CSS Media Query

      ➡    以克服課堂所提的問題

       同樣有對基礎的 element 做 “reset”




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                 42
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               使⽤用 Less+ Framework
          <!-- Global Stylesheets -->
          <link rel="stylesheet" href="reset.css" media="all" />
          <link rel="stylesheet" href="fonts.css" media="all" />
          <link rel="stylesheet" href="style.css" media="all" />

        <!-- Fallback if browser does not support media queries + javascript (Read: Internet
Explorer 7 - 8) -->
        <link rel="stylesheet" href="10col.css" media="all" />

          <!-- Media Queries / LESS -->
          <link rel="stylesheet" href="10col.css" media="only screen and (min-width: 992px)" /
>
          <link rel="stylesheet" href="8col.css" media="only screen and (min-width: 768px)
and (max-width: 991px)" />
       <link rel="stylesheet" href="3col.css" media="only screen and (max-width: 767px)" />
       <link rel="stylesheet" href="5col.css" media="only screen and (min-width: 480px)
and (max-width: 767px)" />
Source: http://www.angrycreative.se/wordpress/plugins/less-framework/


    Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                             43
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                        總結
       “reset” + “base” 將成為 cross device 的重要技術

       ⼤大部份 UI Framework 都會進⾏行 “reset”

       “base” 部份⺫⽬目前仍需由開發者⾃自⾏行處理

       Cross device (⼋八屏) 的技術關鍵

      ➡    cross-device CSS grid system




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        44
Feature	 Detection	 &	 yepnope	 載入器

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                       45
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                        ⺫⽬目的
       負責實作 HTML5 標準的是瀏覽器

       我們所製作的 HTML5 應⽤用程式會使⽤用到許多 HTML5 特⾊色

       檢查⺫⽬目的瀏覽器是否⽀支援這些特⾊色 (features)




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        46
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


     例如:WebSocket 的⽀支援性
       請參考 http://en.wikipedia.org/wiki/WebSocket




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        47
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


 主要瀏覽器的 WebSocket ⽀支援
       Firefox 6 以後

       Google Chrome 14 以後

       Internet Explorer 10 Developer Preview 以後

       Opera 11 以後⽀支援舊版 WebSocket 實作

       Safari 5 以後⽀支援舊版 WebSocket 實作

       iOS 4.2 以後⽀支援舊版 WebSocket 實作

       Android 4.x 內建瀏覽器不⽀支援 WebSocket




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        48
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


             使⽤用 yepnope Loader




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        49
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  關於 yepnope Loader
           An asynchronous conditional resource loader

           Super-fast

           Allows you to load only the scripts that your users need

          ➡    Load on demand

           以⾮非同步⽅方式載⼊入 Javascript 或其它 resource,可增強 usability

           Yep - yes, has, ok

           Nope - no, doesn’t has, not ok



See more: http://yepnopejs.com


   Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                      50
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                       使⽤用 Modernizr




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        51
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                       關於 Modernizr
       可協助開發者進⾏行 feature detection

       可客製化 Javascript library

       包含 yepnope loader




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        52
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


          使⽤用 modernizr Library

   <!DOCTYPE html>
   <html>
   <head>
   <meta charset="utf-8">
   <title>A HTML5 Page</title>
   <script src="modernizr.min.js"></script>
   </head>
   <body>
   ...
   </body>
   </html>


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        53
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                     是否⽀支援 Canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>A HTML5 Page</title>
<script src="modernizr.min.js"></script>
</head>
<body>
<script>
if (Modernizr.canvas) {
      alert("Your browser supports Canvas");
} else {
    alert("Oh my god. Your need a good browser!");
}
</script>
</body>
</html>


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        54
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                   檢查 LocalStorage

    if (Modernizr.localstorage) {
         // Good
    } else {
         // No good
    }




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                         55
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


           是否⽀支援 Web Workers

    if (Modernizr.webworkers) {
         // Good
    } else {
         // No good
    }




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        56
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Application Cache

   if (Modernizr.applicationcache) {
        // Good
   } else {
        // No good
   }




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        57
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                         Touch Events
       檢查瀏覽器是否⽀支援 touch event

      ➡    if (Modernizr.touch)




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        58
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


             使⽤用 yepnode Loader
       不要使⽤用 <script> 來載⼊入 JavaScript



        <head>
            <meta charset="utf-8">
            <title>NO Game</title>
            <script src="modernizr.min.js"></script>
            <script src="loader.js"></script>
            ...
        </head>




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        59
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


              使⽤用 ‘yepnope’ Loader
  10   window.addEventListener("load", function() {
  11
  12   Modernizr.load([
  13       {
  14         load : [
  15            "jquery.min.js",
  16            "CSSPlugin.min.js",
  17            "TweenLite.min.js"
  18         ],
  19         complete : function() {
  20               start();
  21         }
  22       }
  23   ]);
  24
  25   }, false);


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                          60
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                          Sync and Async
 <script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script>
 <script type="text/javascript" src="js/greensock/TweenLite.min.js"></script>



  12 Modernizr.load([
  13   {
  14     load : [
  15                "jquery.min.js",
  16                "CSSPlugin.min.js",
  17                "TweenLite.min.js"
  18           ],
  19           complete : function() {
  20               start();
  21           }
  22       }
  23 ]);

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                   61
JavaScript	 教學(2)

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                                62
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  使⽤用 Local Storage

 <textarea id="input"></textarea>

 <script>
      var input = document.getElementById("input");

     input.value = localStorage.getItem("mytext") ¦¦ "";

     input.addEventListener("keyup", function() {
           localStorage.setItem("mytext", input.value);
     }, false);


 </script>




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                           63
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


              使⽤用 Session Storage

  <textarea id="input"></textarea>

  <script>
  var input = document.getElementById("input");

  input.value = sessionStorage.getItem("mytext") ¦¦ "";

  input.addEventListener("keyup", function() {
        sessionStorage.setItem("mytext", input.value);
  }, false);


  </script>




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                          64
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  關於 Web Workers
       JavaScript threading

       無法存取 DOM

       可實作 “Message Handler”

       不共⽤用資料

      ➡    無法存取 Parent Thread 的資料




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        65
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                    Web Worker 的⽤用法
          var worker = new Worker(“worker.js”);

          worker.terminate();

          worker.postMessage(“hello webworker”);

          worker.onmessage(function(event) {});

        ➡    worker.addEventListener(“message”, function(event) {}, false);




See more: http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html




 Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                     66
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


  Web Worker 範例:計算 Prime
<p>The highest prime number is: <output id="result"></output></p>
 <script>
   var worker = new Worker('worker.js');
   worker.onmessage = function (event) {
      document.getElementById('result').textContent = event.data;
   };
  </script>
                   // worker.js
                    1 var n = 1;
                    2 search: while (true) {
                    3 n += 1;
                    4 for (var i = 2; i <= Math.sqrt(n); i += 1)
                    5    if (n % i == 0)
                    6     continue search;
                    7 // found a prime!
                    8 postMessage(n); // Don t use return
                    9}




  Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                    67
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                 Prototype 的技術⾯面
       基於 JavaScript 的 Prototype 觀念

      ➡    JavaScript OO

       直接在瀏覽器與 HTML DOM 裡⾯面加⼊入功能 (methods)

       擴充 element 的原貌 (prototype)

       與 jQuery pattern 有何不同?

      ➡    延續第⼀一堂課




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                          68
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


          JavaScript 的 Prototype
       每個 JavaScript 物件都有⼀一個 “prototype” 屬性

       JavaScript 引擎的實作並不提供 class 觀念

      ➡    延續第⼀一堂課的觀念

      ➡    使⽤用 function() 來表⽰示 class,再使⽤用 “new” 來取得 instance

      ➡    Constructor pattern 與 Factory method pattern

      ➡    上述做法,class 並不具備 OOP (C++/Java) 的必要特性

       因此,使⽤用 JavaScript 的 “prototype” 來模擬 class 的 OO 特性




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                               69
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


             Class 宣告 & Instance


   function Person(name, job) {
         this.name = name;
         this.job = job;
         this.queryJob = function() {
               alert(this.job);
         };
   }

   var person = new Person("Jollen", "Software Developer");
   person.queryJob();




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                              70
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


           定義 Functional Object

    var Person = function (name, job) {
         this.name = name;
         this.job = job;
         this.queryJob = function() {
               alert(this.job);
         };
    };

    var jollen = new Person("Jollen", "Software Developer");

    jollen.queryJob();




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                               71
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


              動態加⼊入新的 Method
    var Person = function (name, job) {
         this.name = name;
         this.job = job;
         this.queryJob = function() {
               alert(this.job);
         };
    };

    Person.prototype.getName = function () {
         return this.name;
    }

    var jollen = new Person("Jollen", "Software Developer");

    jollen.queryJob(); // Software Developer
    jollen.getName(); // Jollen



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                               72
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


     改變的是 Prototype (Class)
    var Person = function (name, job) {
         this.name = name;
         this.job = job;
         this.queryJob = function() {
               alert(this.job);
         };
    };

    var jollen = new Person("Jollen", "Software Developer");

    // 順序交換不改變其結果
    Person.prototype.getName = function () {
         return this.name;
    }

    jollen.queryJob(); // Software Developer
    jollen.getName(); // Jollen


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                               73
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


什麼要學 JavaScript Prototype
       Prototype 改變的是 “base object”

       DOM 裡有許多 Function Object (class)

      ➡    如何改變其 base object ?

       使⽤用 JavaScript “prototype” 屬性

       更簡單 “extend DOM’ 的⽅方式

      ➡    使⽤用 prototype.js




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        74
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                        引⼊入 Prototype.js




See more: http://prototypejs.org




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                             75
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                    使⽤用 Prototype.js
       加⼊入 prototype.js

      ➡    JavaScript prototype library




 <script
 src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js>
 </script>




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                             76
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                      關於 Prototype.js
       Prototype provides functions to make HTML DOM
       programming easier

       Like jQuery, Prototype has its $() function

       The $() function accepts HTML DOM element id values (or
       DOM elements), and adds new functionality to DOM objects

       Unlike jQuery, Prototype has no ready() method to take the
       place of window.onload(). Instead, Prototype adds
       extensions to the browser and the HTML DOM



 See more: http://www.w3schools.com/js/js_lib_prototype.asp



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                    77
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                         Prototype.js 範例
                                          See more: http://www.w3schools.com/dom/dom_element.asp
<div id="watch"></div>
<script>
var w = document.getElementById("watch");
w.setAttribute();       // OK. DOM Element 裡的 method

// Prototype.js 的官方範例
var MyUtils = {
   truncate: function(element, length){
      element = $(element);
      return element.update(element.innerHTML.truncate(length));
   },
   updateAndMark: function(element, html){
      return $(element).update(html).addClassName('updated');
   }
                                                                    See more: http://prototypejs.org
};

Element.addMethods(MyUtils); // Prototype.js 擴充 DOM

$('watch').truncate(100); // OK. 使用 Prototype 擴充了 Element
$('watch').helloWorld();  // OK.
w.helloWorld();           // OK. 呼叫 DOM
 Copyright (C) 2013 Moko365 Inc. All Rights Reserved.
</script>

                                                                                                       78
實作	 Drag	 and	 Drop

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                              79
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               關於 Drag and Drop
       HTML5 的正式標準

       可⽀支援任何的 Element

       直接實作

       或使⽤用 jQuery UI 更為⽅方便

      ➡    可將任何 Element 設定為 Draggable




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        80
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


 使⽤用 Drag and Drop 標籤屬性
<!DOCTYPE HTML>                                                 div1
<html>
<head>                                                        (target) ondrop
</head>
<body>                                                        ondragover

<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>

<img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)"
width="336" height="69">


</body>
</html>



Source: http://www.w3schools.com/html/html5_draganddrop.asp



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                81
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


     實作 Taget 的 onDrop() 事件
 <script>
                                  Source: http://www.w3schools.com/html/html5_draganddrop.asp
 function allowDrop(ev)
 {
   ev.preventDefault();
 }

 function drag(ev)
 {
     ev.dataTransfer.setData("Text",ev.target.id);
 }
                                            prevent the browser default handling of the data
                                            (default is open as link on drop)
 function drop(ev)                          (任何的 event callbacks 都有其 default 處理方式)

 {
   ev.preventDefault();
   var data=ev.dataTransfer.getData("Text");
     ev.target.appendChild(document.getElementById(data));
 }
 </script>
Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                                82
講師:Jack Sun




      認識	 jQuery	 與	 Javascript	 UI	 Framework

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                       83
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                   Agenda
       Introduce jQuery
          Concept

          Hello jQuery

          Examples

       JavaScript UI Framework
          Overview

          Mobile Development

          jQuery UI Examples

          Sencha Touch UI Examples



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        84
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Concept of jQuery
       Client side & Server side




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        85
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Concept of jQuery
       JavaScript Foundations
          HTML DOM 
 – HTML Document Object Model

          AJAX 
 – Asynchronous JavaScript and XML




                                                       jQuery is the most popular

                                                               JavaScript library.




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                     86
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                           Hello jQuery
       Write less, do more.




                           <script src=“http://code.jquery.com/jquery-
                                                       latest.min.js”></script>

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                  87
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》
<!doctype html>
<html>
<head>
                        jQuery Examples
    <meta charset=utf-8>
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></
script>
    <style>
    .emphasis { font-weight: bold;}
    </style>
    <script>
    $(document).ready(function() {
         $('li:first-child').addClass('emphasis');
    });
    </script>
</head>
<body>
<ul>
     <li>hello</li>
     <li>hello 2</li>
    <li>hello 3</li>
</ul>
Copyright (C) 2013 Moko365   Inc. All Rights Reserved.

</body>                                                                             88
</html>
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


            JavaScript UI Framework
       What’s the different between…
          jQuery

                - Is a way to find stuff on a page and work with that
                stuff.

                - Write less, do more, a JavaScript library.
          jQuery UI

                - Is a UI library that works with jQuery. (need jQuery)
          jQuery Mobile

                - Is a UI library for Mobile devices that works with
                jQuery as well. (need jQuery)


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                          89
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


            JavaScript UI Framework
       The Alternatives for Mobile Development

          Zepto (not fully support IE)

          Xui                             How about use all of these…

          jqmobi / jqui            jQuery 
 
   :      'libs/jquery/jquery-loader',
                                   Handlebars 
 :      'libs/handlebars/handlebars-
       Use Cases :                 loader',
                                   Underscore 
 :      'libs/underscore/underscore-
         jQuery + jQuery UI        loader',
                                   Backbone 
 :        'libs/backbone/backbone-loader',
         jQuery + jQuery Mobile    WebSocket 
 :       'libs/websocket-loader',
                                   order 
 
    :      'libs/require/order-1.0.5',
         Zepto/jQuery + jQTouch    text 
    
  :      'libs/require/text-1.0.7',
                                   domReady 
 :        'libs/require/domReady-1.0.0',
         jQuery/Zepto/Xui + Custom UI
                                   iScroll 
 
  :      'libs/iscroll/iscroll-loader',
                                   PhoneGap 
 :        'libs/phonegap/phonegap-loader',
         Sencha Touch (commercial)



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                          90
如何應用	 Bootstrap	 製作	 Responsive	 Website	 Design


Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

          本教材由仕橙3G教室製作與維護

                                                        91
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                                   Agenda
       Introduce Bootstrap
          What’s Bootstrap

          File Structure

          What’s Included

          HTML Template

          Example

          Customize

       Bootstrap Tutorial



Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        92
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       What’s Bootstrap




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        93
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       File Structure




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        94
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       What’s included
          Scaffolding

       Global styles for the body to reset type and background, link styles, grid
            system, and two simple layouts.

          Base CSS

       Styles for common HTML elements like typography, code, tables, forms, and
             buttons. Also includes Glyphicons, a great little icon set.

          Components

       Basic styles for common interface components like tabs and pills, navbar,
             alerts, page headers, and more.

          JavaScript plugins

       Similar to Components, these JavaScript plugins are interactive components for
             things like tooltips, popovers, modals, and more.

Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                                                        95
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       HTML Template




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        96
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       Example




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        97
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


               Introduce Bootstrap
       Customize




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        98
《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》


                  Bootstrap Tutorial
  Create a Responsive Design Blog using Bootstrap.




Copyright (C) 2013 Moko365 Inc. All Rights Reserved.

                                                        99
更多資訊請上 Go8Panel.com

                      100

More Related Content

PDF
Startup eng-camp 3
PDF
課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(3)
PDF
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
PDF
HTML5ではないサイトを HTML5へ - Change HTML5 from Not HTML5.
PDF
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
PDF
Under the Hood of Reactive Data Access (2/2)
PDF
Under the Hood of Reactive Data Access (1/2)
PPTX
Getting Started with HTML5 in Tech Com (STC 2012)
Startup eng-camp 3
課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(3)
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
HTML5ではないサイトを HTML5へ - Change HTML5 from Not HTML5.
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Under the Hood of Reactive Data Access (2/2)
Under the Hood of Reactive Data Access (1/2)
Getting Started with HTML5 in Tech Com (STC 2012)

What's hot (20)

PPTX
Reactive Data Access with Spring Data
PPT
GWT + Gears : The browser is the platform
PDF
JDBC, What Is It Good For?
PDF
GWT Reloaded
PDF
Comparing JVM Web Frameworks - Rich Web Experience 2010
PPTX
Consumer Driven Contracts and Your Microservice Architecture
PDF
Vaadin += GWT
PDF
Not Only Reactive - Data Access with Spring Data
PDF
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
PDF
Front End Development for Backend Developers - GIDS 2019
PPTX
Amp by Google: The Present And Future Of Quick Content Delivery
PDF
A Gentle Introduction to Angular Schematics - Angular SF 2019
PDF
Java REST API Framework Comparison - PWX 2021
PDF
Hybrid Apps (Native + Web) via QtWebKit
PDF
Spark IT 2011 - Developing RESTful Web services with JAX-RS
PPT
Choosing a Java Web Framework
PPT
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
PDF
JAX-RS JavaOne Hyderabad, India 2011
PDF
What the Heck is OAuth and OpenID Connect - RWX 2017
PDF
Spark IT 2011 - Java EE 6 Workshop
Reactive Data Access with Spring Data
GWT + Gears : The browser is the platform
JDBC, What Is It Good For?
GWT Reloaded
Comparing JVM Web Frameworks - Rich Web Experience 2010
Consumer Driven Contracts and Your Microservice Architecture
Vaadin += GWT
Not Only Reactive - Data Access with Spring Data
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
Front End Development for Backend Developers - GIDS 2019
Amp by Google: The Present And Future Of Quick Content Delivery
A Gentle Introduction to Angular Schematics - Angular SF 2019
Java REST API Framework Comparison - PWX 2021
Hybrid Apps (Native + Web) via QtWebKit
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Choosing a Java Web Framework
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
JAX-RS JavaOne Hyderabad, India 2011
What the Heck is OAuth and OpenID Connect - RWX 2017
Spark IT 2011 - Java EE 6 Workshop
Ad

Viewers also liked (14)

PDF
課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(1)
PDF
讓 HTML5 走進 IPTV Framework
PDF
HTML5/CSS3 and Future Web in Mobile and IPTV
PPTX
用攝影機(DV)作網路直播
PPTX
最簡單快速的實況開播 - Webcam開播教學
PPTX
用Youtube X LIVEhouse.in 開自己的直播節目 Hosting your own live show by Youtube and LI...
PDF
Civic Media at 0AM 從太陽花零時媒體,想像公眾媒體的未來 - 公視工會勞教講座 20140615
PDF
Xsplit broadcaster 教學
PDF
Smart tv應用與產業發展趨勢
PDF
李慕約&王向榮/如何備料:資料的抓取、清理以及串接
PPTX
【 StraaS 講堂】建立你的影音商業模式
PPTX
如何社群行銷?就是不銷而銷!
PDF
Study: The Future of VR, AR and Self-Driving Cars
PDF
Hype vs. Reality: The AI Explainer
課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(1)
讓 HTML5 走進 IPTV Framework
HTML5/CSS3 and Future Web in Mobile and IPTV
用攝影機(DV)作網路直播
最簡單快速的實況開播 - Webcam開播教學
用Youtube X LIVEhouse.in 開自己的直播節目 Hosting your own live show by Youtube and LI...
Civic Media at 0AM 從太陽花零時媒體,想像公眾媒體的未來 - 公視工會勞教講座 20140615
Xsplit broadcaster 教學
Smart tv應用與產業發展趨勢
李慕約&王向榮/如何備料:資料的抓取、清理以及串接
【 StraaS 講堂】建立你的影音商業模式
如何社群行銷?就是不銷而銷!
Study: The Future of VR, AR and Self-Driving Cars
Hype vs. Reality: The AI Explainer
Ad

Similar to 課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(2) (20)

PDF
[refreshpitt] Adaptive Images in Responsive Web Design
PDF
[html5tx] Adaptive Images in Responsive Web Design
PDF
[HEWEBFL] Adaptive Images in Responsive Web Design
PDF
[cssdevconf] Adaptive Images in RWD
PDF
[refreshaustin] Adaptive Images in Responsive Web Design
PDF
[rwdsummit2012] Adaptive Images in Responsive Web Design
PDF
[drupalcampatx] Adaptive Images in Responsive Web Design
PDF
[wcatx] Adaptive Images in Responsive Web Design
PDF
[convergese] Adaptive Images in Responsive Web Design
PDF
[psuweb] Adaptive Images in Responsive Web Design
PDF
Preventing XSS with Content Security Policy
PPTX
Introduction to Client Side Dev in SharePoint Workshop
PDF
VizEx View HTML5 Workshop
PDF
VizEx View HTML5 Workshop
PDF
Building Amazing Applications with JavaFX
PDF
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
PDF
PharoJS for Real World Applications
PDF
PharoJS for Real World Applications
PDF
[peachpit] Adaptive Images in Responsive Web Design
PPTX
Hello websocket(cn)
[refreshpitt] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design
[HEWEBFL] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in RWD
[refreshaustin] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design
[drupalcampatx] Adaptive Images in Responsive Web Design
[wcatx] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
[psuweb] Adaptive Images in Responsive Web Design
Preventing XSS with Content Security Policy
Introduction to Client Side Dev in SharePoint Workshop
VizEx View HTML5 Workshop
VizEx View HTML5 Workshop
Building Amazing Applications with JavaFX
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
PharoJS for Real World Applications
PharoJS for Real World Applications
[peachpit] Adaptive Images in Responsive Web Design
Hello websocket(cn)

More from Jollen Chen (17)

PDF
Flowchain blockchain classroom at Taiwan Tech University
PDF
Bitmark and Hyperledger Workshop: the Digital Assets and Property
PDF
Introducing the Blockchain and Distributed Ledger Technology
PDF
Maker of Things - the open IoT cloud for makers chapter.
PDF
WoT.City and IoT Protocols Movement @ Taipei, Taiwan
PDF
IoT and Maker Crossover (IMCO) Conference 2015
PDF
Open IoT Cloud Architecture, Web of Things, Shenzhen, China.
PDF
Backbone.js and MVW 101
PDF
Single-Page Application Design Principles 101
PDF
MongoDB & NoSQL 101
PDF
Mokoversity Course: Apple Swift 101 - Introduction
PDF
Android Wear SDK: Level 101
PDF
Android HAL Introduction: libhardware and its legacy
PDF
Jollen's Presentation: Introducing Android low-level
PDF
Embedded Linux: Introduction
PDF
Android Application: Introduction
PDF
Android OS Porting: Introduction
Flowchain blockchain classroom at Taiwan Tech University
Bitmark and Hyperledger Workshop: the Digital Assets and Property
Introducing the Blockchain and Distributed Ledger Technology
Maker of Things - the open IoT cloud for makers chapter.
WoT.City and IoT Protocols Movement @ Taipei, Taiwan
IoT and Maker Crossover (IMCO) Conference 2015
Open IoT Cloud Architecture, Web of Things, Shenzhen, China.
Backbone.js and MVW 101
Single-Page Application Design Principles 101
MongoDB & NoSQL 101
Mokoversity Course: Apple Swift 101 - Introduction
Android Wear SDK: Level 101
Android HAL Introduction: libhardware and its legacy
Jollen's Presentation: Introducing Android low-level
Embedded Linux: Introduction
Android Application: Introduction
Android OS Porting: Introduction

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
MYSQL Presentation for SQL database connectivity
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf

課程名稱:八屏一雲時代來臨 教你HTML5六小時打通(2)

  • 1. 講師:Jollen Chen <jollen@jollen.org> Blog:http://www.jollen.org/blog 課程:http://www.moko365.com 課程專案:鴻海科技集團贊助課程 課程名稱:⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關(2) 課程⽇日期:2013/1/24 (四) 課程時間:10:00~17:00 講義版本:v1.3.0 八屏一雲時代來臨 教你HTML5六小時打通關(2) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 1
  • 3. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 LICENSE NOTICE This work is licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License. You are free: • to Share — to copy, distribute and transmit the work • to make commercial use of the work Under the following conditions: • Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). • No Derivative Works — You may not alter, transform, or build upon this work. With the understanding that: • Waiver — Any of the above conditions can be waived if you get permission from the copyright holder. • Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. • Other Rights — In no way are any of the following rights affected by the license: ◦ Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; ◦ The author's moral rights; ◦ Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. • Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 3
  • 4. 使用 JavaScript 製作動畫: 使用 GreenSock Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 4
  • 5. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 GreenSock Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 5
  • 6. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 GSAP GreenSock Animation Platform (GSAP) 使⽤用 JavaScript Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 6
  • 7. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Tool Suite TweenLite TweenMax TimelineLite TimelineMax Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 7
  • 8. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Crazy Fast Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 8
  • 9. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 JavaScript 效能 在上⼀一堂課所介紹的觀念,效能由瀏覽器引擎的品質決定 在多媒體應⽤用⽅方⾯面,好的 Browser engine + 好的 JavaScript animation library,開始有能⼒力取代傳統的 Native 實作⽅方法 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 9
  • 10. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 GSAP 官⽅方⼊入⾨門教學 ➡ http://www.greensock.com/jump-start-js/ 可單獨執⾏行 ➡ 無須搭配其它 JavaScript 平臺 (eg. jQuery) 可與 jQuery 搭配使⽤用 ➡ 建議只將 jQuery 做為 selector ➡ 不使⽤用 jQuery 的 animation 功能 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 10
  • 11. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 TweenLite <!--- The following scripts are necessary to do TweenLite tweens on CSS properties --> <script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script> <script type="text/javascript" src="js/greensock/TweenLite.min.js"></script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 11
  • 12. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 第⼀一個 GSAP 程式 (TweenLite) logo 元素將以 1 秒的時間,擁有⼀一個 CSS property {left:632px} tween <script> window.onload = function(){ var logo = document.getElementById("logo"); TweenLite.to(logo, 1, {css:{left:"632px"}}); } </script> Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 12
  • 13. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 TweenLite.to() TweenLite.to( [target object], [duration in seconds], [destination values] ) Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 13
  • 14. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Scale & Opacity <div id="demo"> <div class="box" id="red"></div> <div class="box" id="yellow"></div> <div class="box" id="green"></div> </div> var red = document.getElementById("red"), yellow = document.getElementById("yellow"), green = document.getElementById("green"); TweenLite.to([red, yellow, green], 1, {css:{scale:0.2, opacity:0.3}}); (JavaScript array) Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 14
  • 15. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Use jQuery Selector <div id="demo"> <div class="box" id="red"></div> <div class="box" id="yellow"></div> <div class="box" id="green"></div> </div> var red = document.getElementById("red"), yellow = document.getElementById("yellow"), green = document.getElementById("green"); TweenLite.to($(".box"), 1, {css:{scale:0.2, opacity:0.3}}); jQuery Selector Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 15
  • 16. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Event Callbacks onStart onUpdate onComplete onReverse onReverseComplete Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 16
  • 17. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Use Event Callbacks var logo = document.getElementById("logo"), updateOutput = document.getElementById("updateOutput"), completeOutput = document.getElementById("completeOutput"), updateCount = 0; TweenLite.to(logo, 2, {css:{left:"300px"}, onUpdate:updateHandler, onComplete:completeHandler, onCompleteParams:["animation complete!"]}); function updateHandler() { updateCount++; updateOutput.innerHTML = "onUpdate fired " + updateCount; } function completeHandler(message) { completeOutput.innerHTML = "onComplete fired <br/> completeParams = " + message; } Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 17
  • 18. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Control Playback play(), play(5) pause() resume() reverse(), reverse(1) seek(), seek(3) timeScale(), timeScale(0.5), timeScale(2) restart() Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 18
  • 19. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 EasePack <!--- loading easePack because the tween uses a Linear ease --> <script type="text/javascript" src="js/greensock/easing/EasePack.min.js"></script> <script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script> <script type="text/javascript" src="js/greensock/TweenLite.min.js"></script> Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 19
  • 20. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Call restart() Method <div id="demo"> <div id="logo"></div> </div> <input type="button" id="restartBtn" value="restart animation"> var logo = document.getElementById("logo"), restartBtn = document.getElementById("restartBtn"), tween = TweenLite.to(logo, 1, {css:{left:"632px"}}); restartBtn.onclick = function() { tween.restart(); } Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 20
  • 21. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 TweenMax 從 TweenLite 升級到 TweenMax 更多的 Animation 功能 並⽀支援許多 plugins ➡ CSSPlugin ➡ BezierPlugin ➡ RoundPropsPlugin Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 21
  • 22. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 TweenMax <!-- TweenMax includes TweenLite, TimelineLite, TimelineMax, EasePack, RoundPropsPlugin and CSSPlugin --> <script type="text/javascript" src="js/greensock/TweenMax.min.js"></script> var logo = document.getElementById("logo"); TweenMax.to(logo, 1, {css:{left:"300px"}, repeat:3, yoyo:true}); set repeat Tween will smoothly reverse direction each time it repeats Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 22
  • 23. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Stagger staggerTo() staggerFrom() Source: http://www.greensock.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 23
  • 24. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Call staggerTo() Method <div id="demo"> <div class="box" id="red"></div> <div class="box" id="yellow"></div> <div class="box" id="green"></div> <div class="box" id="blue"></div> <div class="box" id="pink"></div> <div class="box" id="purple"></div> </div> var red = document.getElementById("red"), yellow = document.getElementById("yellow"), green = document.getElementById("green"), The fourth parameter called stagger sets the blue = document.getElementById("blue"), amount of time that will transpire between the pink = document.getElementById("pink"), start of each animation. purple = document.getElementById("purple"); //The last parameter with value of .25 is the stagger amount. Try changing it to 1 see how it impacts the animation. TweenMax.staggerTo([red, yellow, green, blue, pink, purple], 1, {css:{scale:0.2, opacity:0.3}}, 0.25); Source: http://www.greensock.com Inc. All Rights Reserved. Copyright (C) 2013 Moko365 24
  • 25. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 TimelineLite 建⽴立⼀一系列的動畫效果 (animation sequences) 使⽤用 TimelineLite 的實例來儲存多個動畫 ( thousands of animations) 將多個動畫群組化 (group) 並視為 single tween 來控制 可將 playback control 使⽤用於 Timeline 群組 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 25
  • 26. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 實例化 TimelineLite <script> $(window).load(function() { var logo = $("#logo"), timelineLite = $("#timelinelite"), tagline = $("#tagline span"), restartBtn = $("#restartBtn"), tl = new TimelineLite(); // Timeline 的實例化 tl.from(logo, 0.5, {css:{left:"-=60px"}, ease:Back.easeOut}) .from(timelinelite, 0.5, {css:{width:"0px", alpha:0}}, -0.02) .staggerFrom(tagline, 0.5, {css:{top:"-=30px", rotation:"-40deg", alpha:0, scale:1.8}, ease:Back.easeOut}, 0.2); restartBtn.click(function() { tl.restart(); }); //show the demoBackground div after DOM is ready and all images loaded TweenLite.set($("#demoBackground"), {css:{visibility:"visible"}}); }); </script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 26
  • 27. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 TimelineLite Lables 加⼊入 lables 以做為導覽列 (navigation) tl.append("skew") // adds a new label .append(getSkewAnimation()) // method returns a TimelineLite instance that gets nested at the end .append(getStaggerAnimation(), "stagger") //creates new label and adds animation there .append(getParticlesAnimation(), "particles") Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 27
  • 28. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 TimelineMax 如同 TweenLite 與 TweenMax 的關係 TimelineMax 可⽀支援 ➡ set repeat ➡ yoyo ➡ currentLabel() ➡ getLabelAfter() ➡ getLablesArray() ➡ tweenFromTo() Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 28
  • 29. 多屏 Layout & CSS 定義: Adaptive CSS Framework Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 29
  • 30. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Less Framework 4 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 30
  • 31. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 課程回顧 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 31
  • 32. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 adapt.js 前次課程使⽤用 替代 CSS Media Query ➡ 有瀏覽器相容性問題 Less Framework 4 是⽐比 adapt.js 更重量級的⼯工具 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 32
  • 33. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 adapt.js <script> var ADAPT_CONFIG = { path: 'css/', dynamic: true, range: [ '0px to 480px = 480.css', '480px to 600px = 600.css', '600px to 720px = 720.css', '720px to 800px = 800.css' ] }; </script> <script src="./adapt.js"></script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 33
  • 34. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 認識 Less Framework 4 CSS grid system For designing adaptive websites 4 layouts 3 sets of typography presets 基於 Media Query 技術 Permissive license (MIT license) ⽀支援 Retina Media Query * Source: http://lessframework.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 34
  • 35. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 4 Layouts Source: http://lessframework.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 35
  • 36. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Less Framework 4 Source: http://lessframework.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 36
  • 37. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 技術⾯面 有對基礎的 element 做 reset ➡ html, body, div, span ... 沒有對不同的瀏覽器與裝置做 “base” ➡ 請參考第⼀一堂課介紹 ➡ Cross browser and cross devices 使⽤用 “px” 較不合適 ➡ 請參考第⼀一堂課介紹 ➡ 改⽤用 “rem” 等較合適的單位 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 37
  • 38. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 技術細節:使⽤用 Media Query /* Wide Mobile Layout: 480px. Gutters: 24px. Outer margins: 22px. Inherits styles from: Default Layout, Mobile Layout. ------------------------------------------------------------ cols 1 2 3 4 5 px 68 160 252 344 436 */ @media only screen and (min-width: 480px) and (max-width: 767px) { body { width: 436px; padding: 36px 22px 48px; } } Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 38
  • 39. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 技術細節:Retina Media Query /* Retina media query. Overrides styles for devices with a device-pixel-ratio of 2+, such as iPhone 4. ----------------------------------------------- */ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { body { } Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 39
  • 40. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 總結 使⽤用 Media Query 做為⼋八屏的基本技術 不需從新寫起,但要了解其原理 (第⼀一堂課) 使⽤用現有的 UI Framework (如 Less Framework 4) 以 Less Framework 4 為例,有些⼋八屏 (cross devices) 的技術細節 未考慮到 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 40
  • 41. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Less+ Framework Source: http://www.angrycreative.se/wordpress/plugins/less-framework/ Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 41
  • 42. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 簡介 Less+ Framework Less+ Framework is a cross-device CSS grid system using media queries Less Framework 4 的⼀一個擴充插件 改⽤用 jQuery Media Query ➡ 取代 CSS Media Query ➡ 以克服課堂所提的問題 同樣有對基礎的 element 做 “reset” Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 42
  • 43. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Less+ Framework <!-- Global Stylesheets --> <link rel="stylesheet" href="reset.css" media="all" /> <link rel="stylesheet" href="fonts.css" media="all" /> <link rel="stylesheet" href="style.css" media="all" /> <!-- Fallback if browser does not support media queries + javascript (Read: Internet Explorer 7 - 8) --> <link rel="stylesheet" href="10col.css" media="all" /> <!-- Media Queries / LESS --> <link rel="stylesheet" href="10col.css" media="only screen and (min-width: 992px)" / > <link rel="stylesheet" href="8col.css" media="only screen and (min-width: 768px) and (max-width: 991px)" /> <link rel="stylesheet" href="3col.css" media="only screen and (max-width: 767px)" /> <link rel="stylesheet" href="5col.css" media="only screen and (min-width: 480px) and (max-width: 767px)" /> Source: http://www.angrycreative.se/wordpress/plugins/less-framework/ Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 43
  • 44. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 總結 “reset” + “base” 將成為 cross device 的重要技術 ⼤大部份 UI Framework 都會進⾏行 “reset” “base” 部份⺫⽬目前仍需由開發者⾃自⾏行處理 Cross device (⼋八屏) 的技術關鍵 ➡ cross-device CSS grid system Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 44
  • 45. Feature Detection & yepnope 載入器 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 45
  • 46. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 ⺫⽬目的 負責實作 HTML5 標準的是瀏覽器 我們所製作的 HTML5 應⽤用程式會使⽤用到許多 HTML5 特⾊色 檢查⺫⽬目的瀏覽器是否⽀支援這些特⾊色 (features) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 46
  • 47. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 例如:WebSocket 的⽀支援性 請參考 http://en.wikipedia.org/wiki/WebSocket Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 47
  • 48. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 主要瀏覽器的 WebSocket ⽀支援 Firefox 6 以後 Google Chrome 14 以後 Internet Explorer 10 Developer Preview 以後 Opera 11 以後⽀支援舊版 WebSocket 實作 Safari 5 以後⽀支援舊版 WebSocket 實作 iOS 4.2 以後⽀支援舊版 WebSocket 實作 Android 4.x 內建瀏覽器不⽀支援 WebSocket Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 48
  • 49. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 yepnope Loader Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 49
  • 50. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 yepnope Loader An asynchronous conditional resource loader Super-fast Allows you to load only the scripts that your users need ➡ Load on demand 以⾮非同步⽅方式載⼊入 Javascript 或其它 resource,可增強 usability Yep - yes, has, ok Nope - no, doesn’t has, not ok See more: http://yepnopejs.com Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 50
  • 51. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Modernizr Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 51
  • 52. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 Modernizr 可協助開發者進⾏行 feature detection 可客製化 Javascript library 包含 yepnope loader Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 52
  • 53. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 modernizr Library <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>A HTML5 Page</title> <script src="modernizr.min.js"></script> </head> <body> ... </body> </html> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 53
  • 54. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 是否⽀支援 Canvas <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>A HTML5 Page</title> <script src="modernizr.min.js"></script> </head> <body> <script> if (Modernizr.canvas) { alert("Your browser supports Canvas"); } else { alert("Oh my god. Your need a good browser!"); } </script> </body> </html> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 54
  • 55. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 檢查 LocalStorage if (Modernizr.localstorage) { // Good } else { // No good } Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 55
  • 56. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 是否⽀支援 Web Workers if (Modernizr.webworkers) { // Good } else { // No good } Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 56
  • 57. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Application Cache if (Modernizr.applicationcache) { // Good } else { // No good } Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 57
  • 58. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Touch Events 檢查瀏覽器是否⽀支援 touch event ➡ if (Modernizr.touch) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 58
  • 59. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 yepnode Loader 不要使⽤用 <script> 來載⼊入 JavaScript <head> <meta charset="utf-8"> <title>NO Game</title> <script src="modernizr.min.js"></script> <script src="loader.js"></script> ... </head> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 59
  • 60. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 ‘yepnope’ Loader 10 window.addEventListener("load", function() { 11 12 Modernizr.load([ 13 { 14 load : [ 15 "jquery.min.js", 16 "CSSPlugin.min.js", 17 "TweenLite.min.js" 18 ], 19 complete : function() { 20 start(); 21 } 22 } 23 ]); 24 25 }, false); Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 60
  • 61. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Sync and Async <script type="text/javascript" src="js/greensock/plugins/CSSPlugin.min.js"></script> <script type="text/javascript" src="js/greensock/TweenLite.min.js"></script> 12 Modernizr.load([ 13 { 14 load : [ 15 "jquery.min.js", 16 "CSSPlugin.min.js", 17 "TweenLite.min.js" 18 ], 19 complete : function() { 20 start(); 21 } 22 } 23 ]); Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 61
  • 62. JavaScript 教學(2) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 62
  • 63. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Local Storage <textarea id="input"></textarea> <script> var input = document.getElementById("input"); input.value = localStorage.getItem("mytext") ¦¦ ""; input.addEventListener("keyup", function() { localStorage.setItem("mytext", input.value); }, false); </script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 63
  • 64. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Session Storage <textarea id="input"></textarea> <script> var input = document.getElementById("input"); input.value = sessionStorage.getItem("mytext") ¦¦ ""; input.addEventListener("keyup", function() { sessionStorage.setItem("mytext", input.value); }, false); </script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 64
  • 65. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 Web Workers JavaScript threading 無法存取 DOM 可實作 “Message Handler” 不共⽤用資料 ➡ 無法存取 Parent Thread 的資料 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 65
  • 66. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Web Worker 的⽤用法 var worker = new Worker(“worker.js”); worker.terminate(); worker.postMessage(“hello webworker”); worker.onmessage(function(event) {}); ➡ worker.addEventListener(“message”, function(event) {}, false); See more: http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 66
  • 67. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Web Worker 範例:計算 Prime <p>The highest prime number is: <output id="result"></output></p> <script> var worker = new Worker('worker.js'); worker.onmessage = function (event) { document.getElementById('result').textContent = event.data; }; </script> // worker.js 1 var n = 1; 2 search: while (true) { 3 n += 1; 4 for (var i = 2; i <= Math.sqrt(n); i += 1) 5 if (n % i == 0) 6 continue search; 7 // found a prime! 8 postMessage(n); // Don t use return 9} Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 67
  • 68. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Prototype 的技術⾯面 基於 JavaScript 的 Prototype 觀念 ➡ JavaScript OO 直接在瀏覽器與 HTML DOM 裡⾯面加⼊入功能 (methods) 擴充 element 的原貌 (prototype) 與 jQuery pattern 有何不同? ➡ 延續第⼀一堂課 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 68
  • 69. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 JavaScript 的 Prototype 每個 JavaScript 物件都有⼀一個 “prototype” 屬性 JavaScript 引擎的實作並不提供 class 觀念 ➡ 延續第⼀一堂課的觀念 ➡ 使⽤用 function() 來表⽰示 class,再使⽤用 “new” 來取得 instance ➡ Constructor pattern 與 Factory method pattern ➡ 上述做法,class 並不具備 OOP (C++/Java) 的必要特性 因此,使⽤用 JavaScript 的 “prototype” 來模擬 class 的 OO 特性 Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 69
  • 70. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Class 宣告 & Instance function Person(name, job) { this.name = name; this.job = job; this.queryJob = function() { alert(this.job); }; } var person = new Person("Jollen", "Software Developer"); person.queryJob(); Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 70
  • 71. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 定義 Functional Object var Person = function (name, job) { this.name = name; this.job = job; this.queryJob = function() { alert(this.job); }; }; var jollen = new Person("Jollen", "Software Developer"); jollen.queryJob(); Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 71
  • 72. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 動態加⼊入新的 Method var Person = function (name, job) { this.name = name; this.job = job; this.queryJob = function() { alert(this.job); }; }; Person.prototype.getName = function () { return this.name; } var jollen = new Person("Jollen", "Software Developer"); jollen.queryJob(); // Software Developer jollen.getName(); // Jollen Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 72
  • 73. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 改變的是 Prototype (Class) var Person = function (name, job) { this.name = name; this.job = job; this.queryJob = function() { alert(this.job); }; }; var jollen = new Person("Jollen", "Software Developer"); // 順序交換不改變其結果 Person.prototype.getName = function () { return this.name; } jollen.queryJob(); // Software Developer jollen.getName(); // Jollen Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 73
  • 74. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 什麼要學 JavaScript Prototype Prototype 改變的是 “base object” DOM 裡有許多 Function Object (class) ➡ 如何改變其 base object ? 使⽤用 JavaScript “prototype” 屬性 更簡單 “extend DOM’ 的⽅方式 ➡ 使⽤用 prototype.js Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 74
  • 75. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 引⼊入 Prototype.js See more: http://prototypejs.org Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 75
  • 76. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Prototype.js 加⼊入 prototype.js ➡ JavaScript prototype library <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js> </script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 76
  • 77. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 Prototype.js Prototype provides functions to make HTML DOM programming easier Like jQuery, Prototype has its $() function The $() function accepts HTML DOM element id values (or DOM elements), and adds new functionality to DOM objects Unlike jQuery, Prototype has no ready() method to take the place of window.onload(). Instead, Prototype adds extensions to the browser and the HTML DOM See more: http://www.w3schools.com/js/js_lib_prototype.asp Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 77
  • 78. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Prototype.js 範例 See more: http://www.w3schools.com/dom/dom_element.asp <div id="watch"></div> <script> var w = document.getElementById("watch"); w.setAttribute(); // OK. DOM Element 裡的 method // Prototype.js 的官方範例 var MyUtils = { truncate: function(element, length){ element = $(element); return element.update(element.innerHTML.truncate(length)); }, updateAndMark: function(element, html){ return $(element).update(html).addClassName('updated'); } See more: http://prototypejs.org }; Element.addMethods(MyUtils); // Prototype.js 擴充 DOM $('watch').truncate(100); // OK. 使用 Prototype 擴充了 Element $('watch').helloWorld(); // OK. w.helloWorld(); // OK. 呼叫 DOM Copyright (C) 2013 Moko365 Inc. All Rights Reserved. </script> 78
  • 79. 實作 Drag and Drop Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 79
  • 80. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 關於 Drag and Drop HTML5 的正式標準 可⽀支援任何的 Element 直接實作 或使⽤用 jQuery UI 更為⽅方便 ➡ 可將任何 Element 設定為 Draggable Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 80
  • 81. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 使⽤用 Drag and Drop 標籤屬性 <!DOCTYPE HTML> div1 <html> <head> (target) ondrop </head> <body> ondragover <div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div> <img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)" width="336" height="69"> </body> </html> Source: http://www.w3schools.com/html/html5_draganddrop.asp Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 81
  • 82. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 實作 Taget 的 onDrop() 事件 <script> Source: http://www.w3schools.com/html/html5_draganddrop.asp function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("Text",ev.target.id); } prevent the browser default handling of the data (default is open as link on drop) function drop(ev) (任何的 event callbacks 都有其 default 處理方式) { ev.preventDefault(); var data=ev.dataTransfer.getData("Text"); ev.target.appendChild(document.getElementById(data)); } </script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 82
  • 83. 講師:Jack Sun 認識 jQuery 與 Javascript UI Framework Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 83
  • 84. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Agenda Introduce jQuery Concept Hello jQuery Examples JavaScript UI Framework Overview Mobile Development jQuery UI Examples Sencha Touch UI Examples Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 84
  • 85. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Concept of jQuery Client side & Server side Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 85
  • 86. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Concept of jQuery JavaScript Foundations HTML DOM – HTML Document Object Model AJAX – Asynchronous JavaScript and XML jQuery is the most popular JavaScript library. Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 86
  • 87. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Hello jQuery Write less, do more. <script src=“http://code.jquery.com/jquery- latest.min.js”></script> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 87
  • 88. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 <!doctype html> <html> <head> jQuery Examples <meta charset=utf-8> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></ script> <style> .emphasis { font-weight: bold;} </style> <script> $(document).ready(function() { $('li:first-child').addClass('emphasis'); }); </script> </head> <body> <ul> <li>hello</li> <li>hello 2</li> <li>hello 3</li> </ul> Copyright (C) 2013 Moko365 Inc. All Rights Reserved. </body> 88 </html>
  • 89. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 JavaScript UI Framework What’s the different between… jQuery - Is a way to find stuff on a page and work with that stuff. - Write less, do more, a JavaScript library. jQuery UI - Is a UI library that works with jQuery. (need jQuery) jQuery Mobile - Is a UI library for Mobile devices that works with jQuery as well. (need jQuery) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 89
  • 90. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 JavaScript UI Framework The Alternatives for Mobile Development Zepto (not fully support IE) Xui How about use all of these… jqmobi / jqui jQuery : 'libs/jquery/jquery-loader', Handlebars : 'libs/handlebars/handlebars- Use Cases : loader', Underscore : 'libs/underscore/underscore- jQuery + jQuery UI loader', Backbone : 'libs/backbone/backbone-loader', jQuery + jQuery Mobile WebSocket : 'libs/websocket-loader', order : 'libs/require/order-1.0.5', Zepto/jQuery + jQTouch text : 'libs/require/text-1.0.7', domReady : 'libs/require/domReady-1.0.0', jQuery/Zepto/Xui + Custom UI iScroll : 'libs/iscroll/iscroll-loader', PhoneGap : 'libs/phonegap/phonegap-loader', Sencha Touch (commercial) Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 90
  • 91. 如何應用 Bootstrap 製作 Responsive Website Design Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 本教材由仕橙3G教室製作與維護 91
  • 92. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Agenda Introduce Bootstrap What’s Bootstrap File Structure What’s Included HTML Template Example Customize Bootstrap Tutorial Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 92
  • 93. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap What’s Bootstrap Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 93
  • 94. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap File Structure Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 94
  • 95. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap What’s included Scaffolding Global styles for the body to reset type and background, link styles, grid system, and two simple layouts. Base CSS Styles for common HTML elements like typography, code, tables, forms, and buttons. Also includes Glyphicons, a great little icon set. Components Basic styles for common interface components like tabs and pills, navbar, alerts, page headers, and more. JavaScript plugins Similar to Components, these JavaScript plugins are interactive components for things like tooltips, popovers, modals, and more. Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 95
  • 96. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap HTML Template Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 96
  • 97. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap Example Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 97
  • 98. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Introduce Bootstrap Customize Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 98
  • 99. 《⼋八屏⼀一雲時代來臨 教你HTML5六⼩小時打通關 》 Bootstrap Tutorial Create a Responsive Design Blog using Bootstrap. Copyright (C) 2013 Moko365 Inc. All Rights Reserved. 99