SlideShare une entreprise Scribd logo
1  sur  62
Learning how to use jQuery #3
            YOSHIMURA Takahiro
            twitter: @yosshi
            yosshi@gmail.com
            http://www.greenplastic.net
            http://friendfeed.com/yosshi

            November 11, 2009
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha




Languages
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma
lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika
jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn
ngữ ‫ שפה‬мова ‫ ﺯﺑ# # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba
limbă язык language
for
Markup Engineer
Markup Engineer
• (X)HTML + CSS
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
• Design (not language anyway)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
• Design (not language anyway)
• English
Review



         http://www.flickr.com/photos/themastershakesignal/173060038/
#1
#1
•   ready hundler
#1
•   ready hundler
•   selectors
#1
•   ready hundler
•   selectors
•   css
#1
•   ready hundler
•   selectors
•   css
•   effects
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
•   method chain
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
•   method chain
•   selector
#2
#2
•   Attributes - DOM
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
    •   Text - text(), text(val)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
    •   Text - text(), text(val)
    •   Value - val(), val(val)
#2
•   Manipulation - DOM
#2
•   Manipulation - DOM
    •            - append(content), prepend(content),
        appendTo(content), prependTo(content)
#2
•   Manipulation - DOM
    •             - append(content), prepend(content),
        appendTo(content), prependTo(content)
    •            - after(content), before(content),
        insertAfter(content), insertBefore(content)
#2
•   Manipulation - DOM
    •             - append(content), prepend(content),
        appendTo(content), prependTo(content)
    •            - after(content), before(content),
        insertAfter(content), insertBefore(content)
    •                  - wrap(html), wrap(elem),
        wrapAll(html), wrapAll(elem),
        wrapInner(html), wrapInner(elem)
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)

    •      - empty(), remove()
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)

    •      - empty(), remove()

    •        - clone(), clone(true)
#3
#3

• today
#3

• today
• more events
#3

• today
• more events
• combination of events, css, effects,
  attributes and manipulation
#3

• today
• more events
• combination of events, css, effects,
  attributes and manipulation
• samples and demos
Events
Events
• ready(fn)
• click(fn)
• hover(over, out)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
• change(fn)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
• change(fn)
• keyup(fn)
Events - focus(fn)
$("input").focus(function() {
    $(this).next("span")
           .css('display', 'inline')
           .fadeOut(1000);
});
Events - change(fn)
$("select").change(function() {
    var str = "";
    $("select option:selected").each(function() {
        str += $(this).text() + " ";
    });
    $("div").text(str);
}).change();
Events - keyup(fn)
$("input").keyup(function() {
    $("div").text($(this).val());
}).keyup();




$(window).keyup(function(e) {
    var k = e.keyCode;
    $("div").text(e.keyCode);
    if (k == 13) $("div").append(' return');
});
Samples and Demos



              http://www.flickr.com/photos/neo_ii/4054300112/
Samples and Demos
Samples and Demos

• so-called “don’t click twice”
Samples and Demos

• so-called “don’t click twice”
• so-called “tab”
Samples and Demos

• so-called “don’t click twice”
• so-called “tab”
• so-called “roll over”
Samples and Demos
 • so-called “don’t click twice”
$("form").submit(function() {
    $("input[type=submit]").attr("disabled", "disabled");
});
Samples and Demos
 • so-called “tab”
// hide all content
$("#content > div").hide();

$("#nav li a").click(function() {
    // nav
    $("#nav li").removeClass("current");
    $(this).parent().addClass("current");
    // content
    $("#content > div").hide();
    var cpt = $(this).attr("href");
    $(cpt).show();
    return false;
});
Samples and Demos
  • so-called “roll over”
// preload
$("img.hover").each(function() {
    var preload = new Image;
    preload.src = this.src.replace(/^(.+)(.[a-z]+)$/, "$1_over$2");
});

// so-called roll over
$("img.hover").hover(
    function() {
        $(this).attr("src", function() { return $(this).attr('src').replace(/
^(.+)(.[a-z]+)$/, "$1_over$2"); } );
    },
    function() {
        $(this).attr("src", function() { return $(this).attr('src').replace(/
^(.+)_over(.[a-z]+)$/, "$1$2"); } );
    }
);
One More Thing



             http://www.flickr.com/photos/acaben/541334636/
http://www.flickr.com/photos/mikelowe/9696647/
Ajax



       http://www.flickr.com/photos/mikelowe/9696647/
Ajax
 • load(url, data, callback)
$("#trigger").click(function() {
    $("#wrapper").load("./sample.txt");
});
Ajax
 • jQuery.get(url, data, callback, type)
$("#trigger").click(function() {
    var num = $("select").val();
    $.get("./get.php",
          {id:num},
          function(data) {
              $("#wrapper").text(data);
          }
         );
});
thanks to
•   API reference
    •   http://docs.jquery.com/Main_Page
    •   http://semooh.jp/jquery/

•   jQuery Lesson Series
    •   http://woorkup.com/2009/10/05/jquery-lesson-series-introduction-to-
        selectors/
    •   http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with-
        html-forms/
    •   http://woorkup.com/2009/10/22/jquery-lessons-series-how-to-implement-
        animations-of-css-properties/
    •   http://woorkup.com/2009/11/06/jquery-lessons-series-manipulate-css-
        classes/
thanks to
•   Flickr
    •   http://www.flickr.com/photos/themastershakesignal/173060038/
    •   http://www.flickr.com/photos/neo_ii/4054300112/
    •   http://www.flickr.com/photos/acaben/541334636/
    •   http://www.flickr.com/photos/mikelowe/9696647/
    •   http://www.flickr.com/photos/jenosaur/4051305996/

•   Others
    •   http://www.alink.co.jp/tech/wiki/index.php?jQuery%2F
          %2Fsubmit                    2

    •   http://www.aozora.gr.jp/cards/000148/files/775_14942.html
http://www.flickr.com/photos/jenosaur/4051305996/

Contenu connexe

Tendances

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
Php 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodPhp 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodJeremy Kendall
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentationguestcf600a
 
2018 PyCon Korea - Ring
2018 PyCon Korea - Ring2018 PyCon Korea - Ring
2018 PyCon Korea - RingYunWon Jeong
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmdiKlaus
 

Tendances (17)

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Php 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodPhp 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the Good
 
jQuery Loves You
jQuery Loves YoujQuery Loves You
jQuery Loves You
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
 
2018 PyCon Korea - Ring
2018 PyCon Korea - Ring2018 PyCon Korea - Ring
2018 PyCon Korea - Ring
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
 
jQuery
jQueryjQuery
jQuery
 

Similaire à Learning How To Use Jquery #3

jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoFu Cheng
 
Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3luckysb16
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjangoCalvin Cheng
 
J query introduction
J query introductionJ query introduction
J query introductionSMS_VietNam
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersJonathan Sharp
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuerycolinbdclark
 
Velocity tips and tricks
Velocity tips and tricksVelocity tips and tricks
Velocity tips and tricksdotCMS
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 

Similaire à Learning How To Use Jquery #3 (20)

jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
J query
J queryJ query
J query
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Jquery
JqueryJquery
Jquery
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
J query module1
J query module1J query module1
J query module1
 
Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3
 
Jquery
JqueryJquery
Jquery
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjango
 
Performance patterns
Performance patternsPerformance patterns
Performance patterns
 
J query introduction
J query introductionJ query introduction
J query introduction
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for Developers
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuery
 
Velocity tips and tricks
Velocity tips and tricksVelocity tips and tricks
Velocity tips and tricks
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 

Dernier

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
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
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
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
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Dernier (20)

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
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
 
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
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
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
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Learning How To Use Jquery #3

  • 1. Learning how to use jQuery #3 YOSHIMURA Takahiro twitter: @yosshi yosshi@gmail.com http://www.greenplastic.net http://friendfeed.com/yosshi November 11, 2009
  • 2. tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha Languages језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ# # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language
  • 3. for
  • 6. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on)
  • 7. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript
  • 8. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway)
  • 9. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway) • Design (not language anyway)
  • 10. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway) • Design (not language anyway) • English
  • 11. Review http://www.flickr.com/photos/themastershakesignal/173060038/
  • 12. #1
  • 13. #1 • ready hundler
  • 14. #1 • ready hundler • selectors
  • 15. #1 • ready hundler • selectors • css
  • 16. #1 • ready hundler • selectors • css • effects
  • 17. #1 • ready hundler • selectors • css • effects • events
  • 18. #1 • ready hundler • selectors • css • effects • events • method chain
  • 19. #1 • ready hundler • selectors • css • effects • events • method chain • selector
  • 20. #2
  • 21. #2 • Attributes - DOM
  • 22. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name)
  • 23. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch)
  • 24. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val)
  • 25. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val) • Text - text(), text(val)
  • 26. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val) • Text - text(), text(val) • Value - val(), val(val)
  • 27. #2 • Manipulation - DOM
  • 28. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content)
  • 29. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content) • - after(content), before(content), insertAfter(content), insertBefore(content)
  • 30. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content) • - after(content), before(content), insertAfter(content), insertBefore(content) • - wrap(html), wrap(elem), wrapAll(html), wrapAll(elem), wrapInner(html), wrapInner(elem)
  • 31. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector)
  • 32. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector) • - empty(), remove()
  • 33. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector) • - empty(), remove() • - clone(), clone(true)
  • 34. #3
  • 37. #3 • today • more events • combination of events, css, effects, attributes and manipulation
  • 38. #3 • today • more events • combination of events, css, effects, attributes and manipulation • samples and demos
  • 41. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn)
  • 42. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn) • change(fn)
  • 43. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn) • change(fn) • keyup(fn)
  • 44. Events - focus(fn) $("input").focus(function() { $(this).next("span") .css('display', 'inline') .fadeOut(1000); });
  • 45. Events - change(fn) $("select").change(function() { var str = ""; $("select option:selected").each(function() { str += $(this).text() + " "; }); $("div").text(str); }).change();
  • 46. Events - keyup(fn) $("input").keyup(function() { $("div").text($(this).val()); }).keyup(); $(window).keyup(function(e) { var k = e.keyCode; $("div").text(e.keyCode); if (k == 13) $("div").append(' return'); });
  • 47. Samples and Demos http://www.flickr.com/photos/neo_ii/4054300112/
  • 49. Samples and Demos • so-called “don’t click twice”
  • 50. Samples and Demos • so-called “don’t click twice” • so-called “tab”
  • 51. Samples and Demos • so-called “don’t click twice” • so-called “tab” • so-called “roll over”
  • 52. Samples and Demos • so-called “don’t click twice” $("form").submit(function() { $("input[type=submit]").attr("disabled", "disabled"); });
  • 53. Samples and Demos • so-called “tab” // hide all content $("#content > div").hide(); $("#nav li a").click(function() { // nav $("#nav li").removeClass("current"); $(this).parent().addClass("current"); // content $("#content > div").hide(); var cpt = $(this).attr("href"); $(cpt).show(); return false; });
  • 54. Samples and Demos • so-called “roll over” // preload $("img.hover").each(function() { var preload = new Image; preload.src = this.src.replace(/^(.+)(.[a-z]+)$/, "$1_over$2"); }); // so-called roll over $("img.hover").hover( function() { $(this).attr("src", function() { return $(this).attr('src').replace(/ ^(.+)(.[a-z]+)$/, "$1_over$2"); } ); }, function() { $(this).attr("src", function() { return $(this).attr('src').replace(/ ^(.+)_over(.[a-z]+)$/, "$1$2"); } ); } );
  • 55. One More Thing http://www.flickr.com/photos/acaben/541334636/
  • 57. Ajax http://www.flickr.com/photos/mikelowe/9696647/
  • 58. Ajax • load(url, data, callback) $("#trigger").click(function() { $("#wrapper").load("./sample.txt"); });
  • 59. Ajax • jQuery.get(url, data, callback, type) $("#trigger").click(function() { var num = $("select").val(); $.get("./get.php", {id:num}, function(data) { $("#wrapper").text(data); } ); });
  • 60. thanks to • API reference • http://docs.jquery.com/Main_Page • http://semooh.jp/jquery/ • jQuery Lesson Series • http://woorkup.com/2009/10/05/jquery-lesson-series-introduction-to- selectors/ • http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with- html-forms/ • http://woorkup.com/2009/10/22/jquery-lessons-series-how-to-implement- animations-of-css-properties/ • http://woorkup.com/2009/11/06/jquery-lessons-series-manipulate-css- classes/
  • 61. thanks to • Flickr • http://www.flickr.com/photos/themastershakesignal/173060038/ • http://www.flickr.com/photos/neo_ii/4054300112/ • http://www.flickr.com/photos/acaben/541334636/ • http://www.flickr.com/photos/mikelowe/9696647/ • http://www.flickr.com/photos/jenosaur/4051305996/ • Others • http://www.alink.co.jp/tech/wiki/index.php?jQuery%2F %2Fsubmit 2 • http://www.aozora.gr.jp/cards/000148/files/775_14942.html