AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan...

32
1 Challenge the future AR0051: Digital Presentation Portfolio AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen

Transcript of AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan...

Page 1: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

1Challenge the future

AR0051: Digital Presentation Portfolio

AR0051 – JQuery Nord-Jan VermeerHenry Kiksen

Page 2: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

2Challenge the future

AR0051: Digital Presentation Portfolio

Topics

•When to use javascript/JQuery•Why JQuery•Loading JQuery•One JQuery program explained •Effects/Events•Selector•Demos

Page 3: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

3Challenge the future

AR0051: Digital Presentation Portfolio

When to use Javascript/Jquery

•Use •Improves interaction•Enhance user experience•Create content/styling on the fly

•CSS does not do it....

•Do Not Use•User can disable javascript.

•Not uniform for each browser.

•CSS can do it.

Page 4: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

4Challenge the future

AR0051: Digital Presentation Portfolio

Why JQuery

•Javascript is hard•Not uniform for each browser•Full programming language•Uses kind of a template •CSS like - selector

Page 5: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

5Challenge the future

AR0051: Digital Presentation Portfolio

Loading JQuery<!DOCTYPE html> <html> <head> <script type="application/x-javascript" src=”jquery-1.11.2.min.js”></script> <title>Sample document</title> </head> <body> </body> </html>

•Download the Jquery library from http://jquery.com/•Place it in your web directory•Link the JQuery library with the statement in the green

box.

Page 6: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

6Challenge the future

AR0051: Digital Presentation Portfolio

Demo

•Paragraph hide

Page 7: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

7Challenge the future

AR0051: Digital Presentation Portfolio

The whole script

•Check if document is ready•Check if a p-element is clicked

• Then hide all p-elements

$(document).ready(function(){ $("p").click( function(){ $("p").hide(); } ); });

Page 8: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

8Challenge the future

AR0051: Digital Presentation Portfolio

Check if document is ready

•Check if document is ready•Check if a p-element is clicked

• Then hide all p-elements

$(document).ready( function(){ $("p").click( function(){ $("p").hide(); } ); } );

Page 9: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

9Challenge the future

AR0051: Digital Presentation Portfolio

Check if a p-element is clicked

•Check if document is ready•Check if a p-element is clicked

• Then hide all p-elements

$(document).ready(function(){ $("p").click( function(){ $("p").hide(); } ); });

Page 10: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

10Challenge the future

AR0051: Digital Presentation Portfolio

Hide all p-elements

•Wait until document is ready•Wait until a p-element is clicked

• Then hide all p-elements

$(document).ready(function(){ $("p").click( function(){ $("p").hide(); } ); });

Page 11: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

11Challenge the future

AR0051: Digital Presentation Portfolio

A JQuery statement – effect

$("p").hide();

●Selector – point to the elements.●Do stuff

●Event●Effect

●Selector – point to the elements.●Do stuff

●Event●Effect

Page 12: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

12Challenge the future

AR0051: Digital Presentation Portfolio

JQuery statement - event$(document).ready(function(){

$("p") . click( function(){ $(“p”).hide(); } ); });

●Selector – point to the elements.●Do stuff

●Event: hover, click, dblclick, focus etc. ●Effect

Page 13: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

13Challenge the future

AR0051: Digital Presentation Portfolio

JQuery – Selector

$("p").hide();

●Selector – ●CSS-like way to select the right elements

Page 14: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

14Challenge the future

AR0051: Digital Presentation Portfolio

Grouping effects together

• Do stuff• Append elements to other

elements• Apply CSS to elements• Add class to elements• Hide/show elements• Remove Elements• Alter behavior

$(document).ready( function(){ $("p").click( function(){ $("p").hide(); /* do stuff*/ /* more stuff */ } ); });

Page 15: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

15Challenge the future

AR0051: Digital Presentation Portfolio

Demo 2

•More with the paragraphs

Page 16: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

16Challenge the future

AR0051: Digital Presentation Portfolio

Demo 2

•$(this).hide();•preventDefault()•$(”p”).not(this).hide();

Page 17: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

17Challenge the future

AR0051: Digital Presentation Portfolio

How to create your own•Start by creating a simple HTML-file which:

• Hold the data in a structured manner (ul a)• Minimum on styling

•Create a mockup of a stage in your program• To show the change in html• To show the change in style

•Go back to the simple HTML-file• Create the extra HTML in Jquery• Apply the extra style in Jquery

•Collect the data needed.• Which items change, and what do they change into • Which items are used

• Apply, Beautify

Page 18: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

18Challenge the future

AR0051: Digital Presentation Portfolio

Demo

•Change the image

Page 19: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

19Challenge the future

AR0051: Digital Presentation Portfolio

Demo

•Change the image•Getting an attribute•Using the same script multiple times

• Using a class• Generalize• Setting your own attribute• Getting your own attribute

Page 20: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

20Challenge the future

AR0051: Digital Presentation Portfolio

Tips

• Non obtrusive coding•Do not mix code with HTML •Provide fallback when javascript is unavailable.

•Always apply ; to the end of a javascript statement.•Open code block “{“ before the end of line.

Page 21: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

21Challenge the future

AR0051: Digital Presentation Portfolio

More Information

•http://jquery.com•http://learn.jquery.com•http://www.w3schools.com•http://www.codecademy.com

Page 22: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

22Challenge the future

AR0051: Digital Presentation Portfolio

Questions

•???•

Page 23: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

1 Challenge the future

AR0051 – exercise 3.5 Nord-Jan Vermeer Henry Kiksen

Page 24: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

2 Challenge the future

February 11, 2013

jQuery basics

1.  Selector (what element) 2.  Event (when) 3.  Effect (what will happen) $(“h1”).click( function() { // what to do when an element has been clicked $(this).addClass(“red”); } );

Page 25: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

3 Challenge the future

February 11, 2013

jQuery selectors

http://www.codylindley.com/jqueryselectors/ jQuery documentation: http://api.jquery.com/

Page 26: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

4 Challenge the future

February 11, 2013

Smooth scrolling

https://css-tricks.com/snippets/jquery/smooth-scrolling/

Page 27: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

5 Challenge the future

February 11, 2013

Hoover ideas

http://tympanus.net/Development/HoverEffectIdeas/ http://tympanus.net/Tutorials/OriginalHoverEffects/ Remember to explain the function of the effect!

Page 28: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

6 Challenge the future

February 11, 2013

Exercise week 3.5: for whom? in HTML and CSS

Goal: present one ‘theme’ in your intended portfolio and experiment with content and style

•  this theme might be: photographic or design skills, or urbanism or 3D models (or cakes)

•  think about the essence of your message •  make one page for this theme •  upload your results (deadline: coming Sunday!)

Page 29: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

7 Challenge the future

February 11, 2013

Exercise week 3.6: use HTML, CSS and jQuery

What to do: •  incorporate all lectures •  show some content of your own work, which might

represent you (or not) •  find and show reference websites, both likes and

dislikes •  submit the first draft of your Plan of Approach

Goal: experiment with HTML, CSS and jQuery and browse through your work(s)

Page 30: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

8 Challenge the future

Plan of Approach

“Checklist” •  Is the goal formulated? •  Is this done in depth? •  Is the target-group described specific enough? •  Are the wishes/expectations of the target researched and described? •  Is a selection of own work described as content? •  Is there a description of the extension of presentation of self? •  Is there a balance between image(s) and text? •  Is there a mix between uniqueness and functionality? •  Are there scenarios for navigation and ‘user interface’? •  Has the concept taken ‘fluid’ en ‘responsive’ into account?

Demands on the Plan of Approach

Page 31: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

9 Challenge the future

February 11, 2013

Working in the scheduled workgroups Look at schedule for location! Demand: continue with a “running document” with your thoughts and ideas to work towards a plan of approach!!

Next week, next meeting

Page 32: AR0051 – JQuerytoi.bk.tudelft.nl/downloads/ar0051/ar0051q34-6.pdf · AR0051 – JQuery Nord-Jan Vermeer Henry Kiksen. Challenge the future 2 AR0051: Digital Presentation Portfolio

10 Challenge the future

February 11, 2013

AR0051: Digital Presentation Portfolio

Thank you and

good day