SlideShare a Scribd company logo
1 of 21
ARTDM 170, Week 4:
 JavaScript Effects
          Gilbert Guerrero
         gguerrero@dvc.edu
gilbertguerrero.com/blog/artdm-170/
Turn in Homework
         
Put your files in my dropbox

•   Web page with a rollover animation
•   Put files in a folder with your
    lastname and first initial
•   Example:
         smith-h
            myPage.html
            anim1.gif
JavaScript Effects
JavaScript Frameworks
•   Prototype and Scriptaculous
    ‣   http://prototypejs.org
    ‣   http://script.aculo.us
•   jQuery
    ‣   http://jquery.com
jQuery
Download http://jquery.com
Create a New Web Page
     Open Dreamweaver
Add CSS and an image
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
 www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>page title</title>
 <style type="text/css">
 <!--
 -->
 </style>
 </head>
 <body>
 <div id="box"><img src="pic1.jpg" /></div>
 </body>
 </html>
Add jQuery to the page
• Put this between the <head> tags, all on
 one line
 <script type="text/javascript"
     src="js/jquery-1.4.1.min.js">
     </script>
Hide and Show
$('#box').hide();
$('#box').show();
Example:
<div id="box"><img src="pic1.jpg" /></div>
<a href="#" onclick="$('#box').hide(); return
   false;">Hide</a> 
<a href="#" onclick="$('#box').show(); return
   false;">Show</a> 
Toggle
$('#box').toggle();
Example:
<div id="box"><img src="pic1.jpg" /></div>
<a href="#" onclick="$('#box').toggle(); return
   false;">Show/Hide</a> 
Effects
•   jQuery includes a set of simple,
    standard animations
    ‣   List of effects
Fade Out and Fade In
$('#box').fadeOut(1000);
$('#box').fadeIn(1000);
Animate
$('#box img').animate({width:'90%'}, 1000);
Events
•   jQuery includes a set of methods with
    behaviors that respond to user
    interactions
    ‣   List of events
DOM Ready Function
•   By adding this to the head of your Web
    page you can be sure the elements are
    loaded before applying effects to them
    <script>
    $(document).ready(function () {
    	     //add your functions here
    });
    </script>
Load function
•   We can also use this to show a loading
    animation that disappears when the page
    and all of its images are loaded
    <script>
    $(window).load(function () {
    	     $('#loadingBox').fadeOut();
    });
    </script>
Functions
function slide() {
    $imgs.eq( pos++ ).fadeIn(1000, function() {
            if( pos == $imgs.length ){
                 pos = 0;
                 $imgs.css("display","none");
            }
            slide();
    });
}
Add an overlay to your group
project site
•   Make the overlay open when user
    clicks a button or image
•   Add a close button to the overlay to
    allow the user to close it
•   Use jQuery
Group Projects
...thereʼs one more thing!
Homework due Feb 23
•   Create a Web page with jQuery
    ‣   Make an image fade in, grow, and
        fade out
•   Work on Group Projects
•   Read Chapter 1: Using Flash and
    ActionScript 3.0 in the class textbook
    AS 3.0 Game Programming University
•   Get ready for Adobe Flash next week

More Related Content

What's hot

ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversGilbert Guerrero
 
New text documentfsdfs
New text documentfsdfsNew text documentfsdfs
New text documentfsdfsAh Lom
 
Drupal image gallery_workshop
Drupal image gallery_workshopDrupal image gallery_workshop
Drupal image gallery_workshopHeather Bohn
 
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartBest Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartScott DeLoach
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013dmethvin
 
Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Оксана Одариченко
 
Intro to jQuery - Tulsa Ruby Group
Intro to jQuery - Tulsa Ruby GroupIntro to jQuery - Tulsa Ruby Group
Intro to jQuery - Tulsa Ruby GroupBrad Vernon
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}Eric Carlisle
 
Harness jQuery Templates and Data Link
Harness jQuery Templates and Data LinkHarness jQuery Templates and Data Link
Harness jQuery Templates and Data LinkBorisMoore
 
Using Firebug & YSlow
Using Firebug & YSlowUsing Firebug & YSlow
Using Firebug & YSlowBrad Vernon
 
Mume JQueryMobile Intro
Mume JQueryMobile IntroMume JQueryMobile Intro
Mume JQueryMobile IntroGonzalo Parra
 
20111014 mu me_j_querymobile
20111014 mu me_j_querymobile20111014 mu me_j_querymobile
20111014 mu me_j_querymobileErik Duval
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerErik Isaksen
 
CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11virtualsciences41
 
Java script+mvc+with+emberjs
Java script+mvc+with+emberjsJava script+mvc+with+emberjs
Java script+mvc+with+emberjsji guang
 
Creating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptCreating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptJoseph Khan
 

What's hot (20)

ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
 
New text documentfsdfs
New text documentfsdfsNew text documentfsdfs
New text documentfsdfs
 
Drupal image gallery_workshop
Drupal image gallery_workshopDrupal image gallery_workshop
Drupal image gallery_workshop
 
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartBest Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013
 
Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?
 
Intro to jQuery - Tulsa Ruby Group
Intro to jQuery - Tulsa Ruby GroupIntro to jQuery - Tulsa Ruby Group
Intro to jQuery - Tulsa Ruby Group
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
 
Harness jQuery Templates and Data Link
Harness jQuery Templates and Data LinkHarness jQuery Templates and Data Link
Harness jQuery Templates and Data Link
 
Using Firebug & YSlow
Using Firebug & YSlowUsing Firebug & YSlow
Using Firebug & YSlow
 
Mume JQueryMobile Intro
Mume JQueryMobile IntroMume JQueryMobile Intro
Mume JQueryMobile Intro
 
20111014 mu me_j_querymobile
20111014 mu me_j_querymobile20111014 mu me_j_querymobile
20111014 mu me_j_querymobile
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & Polymer
 
CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11
 
Java script+mvc+with+emberjs
Java script+mvc+with+emberjsJava script+mvc+with+emberjs
Java script+mvc+with+emberjs
 
The canvas tag
The canvas tagThe canvas tag
The canvas tag
 
Creating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptCreating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScript
 
Basics of VueJS
Basics of VueJSBasics of VueJS
Basics of VueJS
 
jQuery quick tips
jQuery quick tipsjQuery quick tips
jQuery quick tips
 

Viewers also liked

ARTDM 171 Week 8: Remapping Cyberspace
ARTDM 171 Week 8: Remapping CyberspaceARTDM 171 Week 8: Remapping Cyberspace
ARTDM 171 Week 8: Remapping CyberspaceGilbert Guerrero
 
ARTDM 171 Week 3: Tags + Group Projects
ARTDM 171 Week 3: Tags + Group ProjectsARTDM 171 Week 3: Tags + Group Projects
ARTDM 171 Week 3: Tags + Group ProjectsGilbert Guerrero
 
ARTDM 170 Week 4: JavaScript Effects
ARTDM 170 Week 4: JavaScript EffectsARTDM 170 Week 4: JavaScript Effects
ARTDM 170 Week 4: JavaScript EffectsGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
ARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAGilbert Guerrero
 
Artdm170 week6 scripting_motion
Artdm170 week6 scripting_motionArtdm170 week6 scripting_motion
Artdm170 week6 scripting_motionGilbert Guerrero
 
Designing for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightDesigning for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightGilbert Guerrero
 

Viewers also liked (7)

ARTDM 171 Week 8: Remapping Cyberspace
ARTDM 171 Week 8: Remapping CyberspaceARTDM 171 Week 8: Remapping Cyberspace
ARTDM 171 Week 8: Remapping Cyberspace
 
ARTDM 171 Week 3: Tags + Group Projects
ARTDM 171 Week 3: Tags + Group ProjectsARTDM 171 Week 3: Tags + Group Projects
ARTDM 171 Week 3: Tags + Group Projects
 
ARTDM 170 Week 4: JavaScript Effects
ARTDM 170 Week 4: JavaScript EffectsARTDM 170 Week 4: JavaScript Effects
ARTDM 170 Week 4: JavaScript Effects
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
ARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QA
 
Artdm170 week6 scripting_motion
Artdm170 week6 scripting_motionArtdm170 week6 scripting_motion
Artdm170 week6 scripting_motion
 
Designing for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightDesigning for Skepticism and Bright Sunlight
Designing for Skepticism and Bright Sunlight
 

Similar to Artdm170 Week4 Java Script Effects

Jquery presentation
Jquery presentationJquery presentation
Jquery presentationMevin Mohan
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 
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
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponentsMartin Hochel
 
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
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)jeresig
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversGilbert Guerrero
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the WorldJonathan Snook
 
Artdm 170 week15 publishing
Artdm 170 week15 publishingArtdm 170 week15 publishing
Artdm 170 week15 publishingGilbert Guerrero
 
Overlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MyOverlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MySteve McMahon
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)jeresig
 
JQuery in Seaside
JQuery in SeasideJQuery in Seaside
JQuery in SeasideESUG
 

Similar to Artdm170 Week4 Java Script Effects (20)

Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 
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
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 
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)
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)
 
J query intro_29thsep_alok
J query intro_29thsep_alokJ query intro_29thsep_alok
J query intro_29thsep_alok
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: Rollovers
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the World
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
Artdm 170 week15 publishing
Artdm 170 week15 publishingArtdm 170 week15 publishing
Artdm 170 week15 publishing
 
Blockly
BlocklyBlockly
Blockly
 
Overlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh MyOverlays, Accordions & Tabs, Oh My
Overlays, Accordions & Tabs, Oh My
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)
 
JQuery in Seaside
JQuery in SeasideJQuery in Seaside
JQuery in Seaside
 
jQuery for Seaside
jQuery for SeasidejQuery for Seaside
jQuery for Seaside
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
J queryui
J queryuiJ queryui
J queryui
 

More from Gilbert Guerrero

ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysGilbert Guerrero
 
ARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingGilbert Guerrero
 
ARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesGilbert Guerrero
 
Artdm170 week12 user_interaction
Artdm170 week12 user_interactionArtdm170 week12 user_interaction
Artdm170 week12 user_interactionGilbert Guerrero
 
Artdm 171 Week12 Templates
Artdm 171 Week12 TemplatesArtdm 171 Week12 Templates
Artdm 171 Week12 TemplatesGilbert Guerrero
 
ARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsGilbert Guerrero
 
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesGilbert Guerrero
 
ARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceGilbert Guerrero
 
ARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceGilbert Guerrero
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 Week5 Intro To Flash
Artdm170 Week5 Intro To FlashArtdm170 Week5 Intro To Flash
Artdm170 Week5 Intro To FlashGilbert Guerrero
 
ARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsGilbert Guerrero
 

More from Gilbert Guerrero (20)

Artdm 171 week15 seo
Artdm 171 week15 seoArtdm 171 week15 seo
Artdm 171 week15 seo
 
ARTDM 171, Week 14: Forms
ARTDM 171, Week 14: FormsARTDM 171, Week 14: Forms
ARTDM 171, Week 14: Forms
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + Arrays
 
ARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to Processing
 
ARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation Schemes
 
Artdm170 week12 user_interaction
Artdm170 week12 user_interactionArtdm170 week12 user_interaction
Artdm170 week12 user_interaction
 
Artdm 171 Week12 Templates
Artdm 171 Week12 TemplatesArtdm 171 Week12 Templates
Artdm 171 Week12 Templates
 
ARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page Comps
 
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
 
ARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User Experience
 
ARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping Cyberspace
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting Interactivity
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm171 Week6 Images
Artdm171 Week6 ImagesArtdm171 Week6 Images
Artdm171 Week6 Images
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm170 Week5 Intro To Flash
Artdm170 Week5 Intro To FlashArtdm170 Week5 Intro To Flash
Artdm170 Week5 Intro To Flash
 
Artdm171 Week5 Css
Artdm171 Week5 CssArtdm171 Week5 Css
Artdm171 Week5 Css
 
Artdm171 Week4 Tags
Artdm171 Week4 TagsArtdm171 Week4 Tags
Artdm171 Week4 Tags
 
ARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group Projects
 

Artdm170 Week4 Java Script Effects

  • 1. ARTDM 170, Week 4: JavaScript Effects Gilbert Guerrero gguerrero@dvc.edu gilbertguerrero.com/blog/artdm-170/
  • 3. Put your files in my dropbox • Web page with a rollover animation • Put files in a folder with your lastname and first initial • Example:      smith-h myPage.html anim1.gif
  • 5. JavaScript Frameworks • Prototype and Scriptaculous ‣ http://prototypejs.org ‣ http://script.aculo.us • jQuery ‣ http://jquery.com
  • 7. Create a New Web Page Open Dreamweaver
  • 8. Add CSS and an image <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>page title</title> <style type="text/css"> <!-- --> </style> </head> <body> <div id="box"><img src="pic1.jpg" /></div> </body> </html>
  • 9. Add jQuery to the page • Put this between the <head> tags, all on one line <script type="text/javascript" src="js/jquery-1.4.1.min.js"> </script>
  • 10. Hide and Show $('#box').hide(); $('#box').show(); Example: <div id="box"><img src="pic1.jpg" /></div> <a href="#" onclick="$('#box').hide(); return false;">Hide</a>  <a href="#" onclick="$('#box').show(); return false;">Show</a> 
  • 11. Toggle $('#box').toggle(); Example: <div id="box"><img src="pic1.jpg" /></div> <a href="#" onclick="$('#box').toggle(); return false;">Show/Hide</a> 
  • 12. Effects • jQuery includes a set of simple, standard animations ‣ List of effects
  • 13. Fade Out and Fade In $('#box').fadeOut(1000); $('#box').fadeIn(1000);
  • 15. Events • jQuery includes a set of methods with behaviors that respond to user interactions ‣ List of events
  • 16. DOM Ready Function • By adding this to the head of your Web page you can be sure the elements are loaded before applying effects to them <script> $(document).ready(function () { //add your functions here }); </script>
  • 17. Load function • We can also use this to show a loading animation that disappears when the page and all of its images are loaded <script> $(window).load(function () { $('#loadingBox').fadeOut(); }); </script>
  • 18. Functions function slide() { $imgs.eq( pos++ ).fadeIn(1000, function() { if( pos == $imgs.length ){ pos = 0; $imgs.css("display","none"); } slide(); }); }
  • 19. Add an overlay to your group project site • Make the overlay open when user clicks a button or image • Add a close button to the overlay to allow the user to close it • Use jQuery
  • 21. Homework due Feb 23 • Create a Web page with jQuery ‣ Make an image fade in, grow, and fade out • Work on Group Projects • Read Chapter 1: Using Flash and ActionScript 3.0 in the class textbook AS 3.0 Game Programming University • Get ready for Adobe Flash next week