SlideShare a Scribd company logo
1 of 51
Download to read offline
IMPORTANT NOTICE
Next week, students will be required to hand in wireframes
for their final projects. You can create wireframes using tools
like Balsamiq Mockups, Sketch or just plain old pen and
paper.
Previous FEWD projects from around the world are here:
https://gallery.generalassemb.ly/FEWD
FEWD - WEEK 4
WILL MYERS
Freelance Front End Developer
SLIDES
http://www.slideshare.net/wilkom/fewd-week4-slides
YOUR WEEKLY FEWD GITHUB
REPOSITORY
Use the '+' button in the top-left of GitHub Desktop
(Create tab)
Create a new repository called 'FEWD_Week4'
Choose the [home]/FEWD folder for the local path
Open this repo folder in your editor
Commit the changes and publish the FEWD_Week4
repository to github.com
YOUR WEEKLY WORKING FILES
FROM ME
To get the week4_working_files you should just be able to
select the ga-fewd-files repository in GitHub Desktop and
press 'Sync'. This should pull in this weeks folder from
github.com.
If you any difficulties you should just re-clone the ga-fewd-
files repository.
Copy the whole week4_working_files into your FEWD_Week4
repository and commit and publish to github.com
AGENDA
Introduction To Programming
What JS Can Do
Reading JS
Lab
ASSIGNMENT FOR TODAY
Continue with Relaxr using JavaScript and jQuery
Also...
IMPORTANT NOTICE
Next week, students will be required to hand in wireframes
for their final projects. You can create wireframes using tools
like Balsamiq Mockups, Sketch or just plain old pen and
paper.
Previous FEWD projects from around the world are here:
https://gallery.generalassemb.ly/FEWD
INTRODUCTION TO PROGRAMMING
So far we have looked at HTML as a markup language, and
CSS as a styling language. We now want to think about a
programming language so that we can get the computer to
perform tasks.
INTRODUCTION TO PROGRAMMING
The computer will do what you tell it to do.
WHAT IS A PROGRAM
A program is a set of instructions that you write to tell a
computer what to do
WHAT IS PROGRAMMING
Programming is the task of writing those instructions in a
language that the computer can understand.
BECOMING A PROGRAMMER
At the beginning, it isn't about the programming language. It
is about changing how you think.
We have to know how the computer thinks to change how
we think.
HOW COMPUTERS 'THINK'
The short answer is that they don't think.
The slightly longer answer is that while computers donâ​​t
think, they act as if they do, by sequentially executing simple
instructions.
The only things a computer knows are the things we tell it.
PSEUDO CODE
Pseudocode is the process of writing a program without
using the syntax of a programming language.
Pseudocode is a mixture of natural language and high-level
programming constructs. For example,
If the door is closed and I want to exit the room, then open
the door
We can pseudocode to train our brain for programming.
PSEUDO CODE
In pseudocode we can introduce simple bits of
programming syntax and naming conventions.
join meaningful words together with underscores to
imply a computer task or some computer data e.g.
my_email_inbox
use verbs to imply a computer task (action): e.g.
get_my_email
use some high-level programming syntax like
if...thenor repeat
use simple arithmetic operators like =(assignment), ==
(equals), <(less than), >(greater than)
THERMOSTAT PSEUDOCODE
Let's try and write the pseudocode for a thermostat that
controls a heater
what data do we need to know from the thermostat?
what actions do we want to be able to do with the heater?
how often should we be performing our actions?
THERMOSTAT PSEUDOCODE
get target_temperature
target_temperature = 72
repeat forever,
current_temperature = get_sensor_reading
if target_temperature > (current_temperature+5),
turn_on_heater
if target_temperature <= current_temperature,
turn_off_heater
ROCK PAPER SCISSORS PSEUDOCODE
What does each thing have in common with the other
two?
What happens each time a turn takes place?
What happens each time that is different?
What happens each time that is the same?
WHAT IS JAVASCRIPT
JavaScript is the behaviour of a web site.
HTML - Document Structure
CSS - Looks, Style
JavaScript - Logic, Functionality, Behavior
It is historically seen as wrong to mix these things up.
Putting things where they belong reduces complexity and
increases maintainability. However some new JS
frameworks are challenging this way of thinking.
JAVASCRIPT AND THE DOM
JavaScript in the browser has an API (application program
interface) for accessing and editing the DOM (the document
object model) of an HTML document. The DOM is a
hierarchical tree representation of the structure of the
HTML.
JavaScript can target specific elements on an HTML page
and show, hide, style, edit and animate them. It can also
listen for events emitted by an HTML page (e.g mouse-clicks)
and invoke functions when an event occurs.
WHAT CAN JAVASCRIPT DO?
Front-end website logic - user input event handling,
dynamically applying styles
<canvas>, <audio>, <video>
Server-side NodeJS
WebGL
(works in Firefox)
https://developer.mozilla.org/samples/video/chroma-
key/index.xhtml
http://mdn.github.io/canvas-raycaster/
http://webaudiodemos.appspot.com/wubwubwub/index.ht
ml
http://threejs.org/examples/
COLOR SWITCHER
Open week4_working_files/color_scheme_switcher
Let's think about the control flow of a program.
We will think in a more high-level way about coding at first.
JavaScript syntax will come later.
COLOR SWITCHER - CONTROL FLOW
In computer science, control flow (or alternatively, flow of
control) is the order in which individual statements,
instructions or function calls of an imperative program are
executed or evaluated. [Wikipedia]
In js/index.jstry moving the <script>link for the
JavaScript out of the <body>and into the <head>.
What is happening in js/index.js?
EVENTS
An event is something that happens that other things can
respond to. An object triggers an event, and an event
listener (or handler) fires when the event is triggered.
E.g. the clickevent occurs when the user clicks on an
element.
An event and event listener are an implementation of the
Observer pattern - a pattern is a recognised and repeated
way of programming. The Observer pattern involves an
observable object (which triggers the event) and an
observer listener (which responds to the event).
TRAFFIC LIGHT
Go to this CodePen: http://codepen.io/nevan/pen/shtLA
The green light does not work. Change the code so that the
traffic light works correctly.
AGENDA AFTER LUNCH
Intro To Programming Reivew
Intro To jQuery
jQuery Basics
File Structure
Syntax
Adding Interactivity
INTRO TO PROGRAMMING REVIEW
Any questions?
INTRO TO JQUERY
jQuery is a cross-browser JavaScript library, designed to
simplify front-end JavaScript web programming.
jQuery is written in JavaScript.
JQUERY
jQuery is designed to make the following things easier:
Document traversal
Modify the appearance of the page (CSS Manipulation)
Edit the page content
Respond to user interaction (Event Handling)
Add animation
Retrieve data from a server using AJAX (Asynchronous
JavaScript and XML)
Simplify common JavaScript tasks
JQUERY
jQuery also provides the following useful features:
uses CSS selector syntax
supports extensions
abstracts away browser quirks
allows multiple actions to be defined in one line with
chaining
JQUERY VS VANILLA JS
Open week4_working_files/styling-css-with-jquery and
week4_working_files/styling-css-with-js
The advantages of jQuery for a new programmer is that
there is less code to right, it is somewhat easier to read and
understand, and it is cross-browser compatible.
DISADVANTAGES OF JQUERY
The two main downsides to using the jQuery library are:
it is an additional file download which will delay
rendering your website for the first time
it is an abstraction which has slower performance than
using native functionality.
DO WE NEED JQUERY?
jQuery is a mature and robust library that provides cross-
browser compatibility for a wide range of tasks. This has
made it very popular over the years, particularly when
supporting browsers like IE.
But browsers are evolving and it is now possible to use
native JavaScript APIs that are much faster and have good
support across newer browsers.
For example document.querySelectorand
document.querySelectorAllallow selecting
elements from the DOM with CSS selector syntax and are
now relatively mature.
DO WE NEED JQUERY?
jQuery is still an important library, particularly for a new
web programmer. Its maturity and cross-browser
compatibility are still essential for many web sites. So it is
still worth learning.
But remember that you can and will eventually do more
JavaScript without an abstraction like jQuery. jQuery will
slowly become less important as native browser
functionality matures over time.
(Keep this link open)http://youmightnotneedjquery.com/
http://stackoverflow.com/questions/11503534/jquery-vs-
document-queryselectorall
JS/JQUERY BASICS
Saying all that, this week we'll use jQuery to add JavaScript
to our web pages. Because it is easier, we can use it as a
stepping stone to using vanilla JavaScript.
JQUERY SCRIPT TAGS
Adding jQuery script tag to your website
// Adding the file.
<script src="js/jquery-1.8.3.min.js"></script>
// linking the library from a CDN
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
SYNTAX
Syntax: Spelling and grammar rules of a programming
language.
We will look at jQuery syntax and some basic JS syntax first.
We will look further at vanilla JavaScript syntax next week.
Like with any language, there are formal rules around how
to write it. This is the syntax.
BASIC JAVASCRIPT SYNTAX - PUNCTUATION
Semicolon ;- should come at the end of an
Curly Braces {}- denotes a block of code e.g a function
or an object literal
Parentheses ()- used to invoke (call) a function, or to
evaluate part of an expression
Quotation Marks ""- contains a string of text, e.g. "Hello
World!"
expression
BASIC JAVASCRIPT SYNTAX -
COMMENTS
//Single Line Comments
/* Multi line comments */
Use Cmd + / in your text editor to toggle comments, same as
for CSS and HTML
JQUERY SYNTAX
$ DOLLAR SYMBOL
When you import the jQuery library into your web page the
dollar $symbol by default becomes a global identifier
(global variable) for jQuery.
It is possible to change this, as the dollar symbol is used
widely in different programming languages and libraries.
But most jQuery implementations on the front-end stick
with the $, and we will too.
JQUERY SYNTAX
$ DOLLAR SYMBOL
With jQuery firstly you select a DOM element (DOM traversal)
and it gets wrapped in a jQuery object.
Then you invoke a method on this object which does
something to the selected element, e.g. changes what it
looks like, or adds some user interaction logic.
$("selector").method(argument)
JQUERY SYNTAX - SELECTORS
Selectors are just like CSS
For selecting an element in the DOM, just use the $followed
by parentheses (invocation). The parentheses contain a
string as an argument. This string is a CSS selector.
$("#id")
$(".class")
$("main")
JQUERY SYNTAX - METHODS
To invoke a method on your jQuery-selected element you
use dot syntax, following the selector expression.
You pass further arguments into your method invocation.
E.g. You can change the CSS style on a selected item with
the $.css()method.
$("main").css("border", "10px solid black");
JQUERY CLICK EVENT
https://api.jquery.com/click/
$(myElement).click(someFunction)
This is used for triggering a function call when a user clicks
on an element.
It is a short-form of a more generic jQuery syntax: .on(
"click", handler ).
$('selector').click(doSomething);
function doSomething() {
// make something happen here
}
What's the syntax for a click event handler in vanilla JS?
JQUERY SYNTAX - SOME MORE METHODS
.click
.slideToggle()
.hide()
.show()
.slideUp()
.slideDown()
.children()
.attr()
You can look them up at https://api.jquery.com/
JQUERY TRAFFIC LIGHT
Let's 'jQueryify' our traffic light example. Open up
week4_working_files/jquery_traffic_light_exercise
We can also try and 'jQueryify' the color_scheme_switcher
we looked at earlier. Create a new index_jq.jsfile in
week4_working_files/color_scheme_switcher/js and link this
into the html file instead of index.js.
JQUERY BREAKDOWN
Let's have a look at what was actually happening in the
scrolling page anchor links example from Week 2.
Open up week4_working_files/jquery_scrolling_link
SYNTAX DRILL
Fork this CodePen:
http://codepen.io/GeneralAssembly/pen/EAubl
Try and do the following:
Use jQuery syntax to change all p tags to blue.
Use jQuery to change the size of the boxes etc. |
ADDING INTERACTIVITY
http://codepen.io/nevan/pen/mKzvs
Play around with this code, so you understand what is
happening.
TRIGGERING ANIMATIONS IN VANILLA JS
Open up week4_working_files/scroll_animated_header.
This is vanilla JavaScript, can you understand what is going
on?
A SIMPLE GAME ROCK PAPER
SCISSORS GAME IN VANILLA JS
Open up week4_working_files/rock_paper_scissors
Can you make the game result display in some text in the
page rather than in an alert box?

More Related Content

What's hot

Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps QuicklyGil Irizarry
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]David Wesst
 
Learning from the Best jQuery Plugins
Learning from the Best jQuery PluginsLearning from the Best jQuery Plugins
Learning from the Best jQuery PluginsMarc Grabanski
 
Developing iOS apps on your iPad with XCAB
Developing iOS apps on your iPad with XCABDeveloping iOS apps on your iPad with XCAB
Developing iOS apps on your iPad with XCABCarl Brown
 
Advanced java script essentials v1
Advanced java script essentials v1Advanced java script essentials v1
Advanced java script essentials v1ASHUTOSHPATKAR1
 
Cutting the Fat
Cutting the FatCutting the Fat
Cutting the FatCodemotion
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portlanddmethvin
 
Web development resources brackets
Web development resources bracketsWeb development resources brackets
Web development resources bracketsLaurence Svekis ✔
 
Codemotion Rome 2015 Bluemix Lab Tutorial
Codemotion Rome 2015 Bluemix Lab TutorialCodemotion Rome 2015 Bluemix Lab Tutorial
Codemotion Rome 2015 Bluemix Lab Tutorialgjuljo
 
Cutting the Fat by Tiffany Conroy
Cutting the Fat by Tiffany ConroyCutting the Fat by Tiffany Conroy
Cutting the Fat by Tiffany ConroyCodemotion
 
Learning to be IDE Free (PrDC 2015)
Learning to be IDE Free (PrDC 2015)Learning to be IDE Free (PrDC 2015)
Learning to be IDE Free (PrDC 2015)David Wesst
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web componentsJarrod Overson
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!Evan Mullins
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
Powerful tools for building web solutions
Powerful tools for building web solutionsPowerful tools for building web solutions
Powerful tools for building web solutionsAndrea Tino
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>tutorialsruby
 

What's hot (20)

Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps Quickly
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
 
Learning from the Best jQuery Plugins
Learning from the Best jQuery PluginsLearning from the Best jQuery Plugins
Learning from the Best jQuery Plugins
 
Untangling7
Untangling7Untangling7
Untangling7
 
Developing iOS apps on your iPad with XCAB
Developing iOS apps on your iPad with XCABDeveloping iOS apps on your iPad with XCAB
Developing iOS apps on your iPad with XCAB
 
Advanced java script essentials v1
Advanced java script essentials v1Advanced java script essentials v1
Advanced java script essentials v1
 
Cutting the Fat
Cutting the FatCutting the Fat
Cutting the Fat
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
Web development resources brackets
Web development resources bracketsWeb development resources brackets
Web development resources brackets
 
Codemotion Rome 2015 Bluemix Lab Tutorial
Codemotion Rome 2015 Bluemix Lab TutorialCodemotion Rome 2015 Bluemix Lab Tutorial
Codemotion Rome 2015 Bluemix Lab Tutorial
 
Cutting the Fat by Tiffany Conroy
Cutting the Fat by Tiffany ConroyCutting the Fat by Tiffany Conroy
Cutting the Fat by Tiffany Conroy
 
Learning to be IDE Free (PrDC 2015)
Learning to be IDE Free (PrDC 2015)Learning to be IDE Free (PrDC 2015)
Learning to be IDE Free (PrDC 2015)
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web components
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
Powerful tools for building web solutions
Powerful tools for building web solutionsPowerful tools for building web solutions
Powerful tools for building web solutions
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
 

Viewers also liked

Indiana Science Indicator 5.2.6
Indiana Science Indicator 5.2.6Indiana Science Indicator 5.2.6
Indiana Science Indicator 5.2.6JMHead2
 
Free Scrabble Coaching Camp on Oct 24th/25th 2011
Free Scrabble Coaching Camp on Oct 24th/25th 2011Free Scrabble Coaching Camp on Oct 24th/25th 2011
Free Scrabble Coaching Camp on Oct 24th/25th 2011Nikhil Soneja
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Scienceresearchinventy
 
Panevėžio juozo miltinio
Panevėžio juozo miltinioPanevėžio juozo miltinio
Panevėžio juozo miltiniomiride
 
My twitter account
My twitter accountMy twitter account
My twitter accountVtr-Netlit
 
Conventions of a magazine
Conventions of a magazineConventions of a magazine
Conventions of a magazineThomas Evans
 
Transport services in pune
Transport services in puneTransport services in pune
Transport services in punequickshift
 
H2+landschap+nederland+2 kgt+par+6 7
H2+landschap+nederland+2 kgt+par+6 7H2+landschap+nederland+2 kgt+par+6 7
H2+landschap+nederland+2 kgt+par+6 7MStegeman
 
Informe lab 2_hidraulica_mbreytmann (2)
Informe lab 2_hidraulica_mbreytmann (2)Informe lab 2_hidraulica_mbreytmann (2)
Informe lab 2_hidraulica_mbreytmann (2)IRenzo Vilca
 
Морской фасад в контексте Одессы
Морской фасад в контексте ОдессыМорской фасад в контексте Одессы
Морской фасад в контексте ОдессыInna Nikolaeva
 
Учи неучёного
Учи неучёногоУчи неучёного
Учи неучёного0leGG
 
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE Equalizer
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE EqualizerPerformance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE Equalizer
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE EqualizerIJERA Editor
 
孫越的甦醒
孫越的甦醒孫越的甦醒
孫越的甦醒Jaing Lai
 
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...Association BIOGEN
 
Saving Struggling Quality Teams
Saving Struggling Quality TeamsSaving Struggling Quality Teams
Saving Struggling Quality Teamsahmad bassiouny
 

Viewers also liked (20)

Indiana Science Indicator 5.2.6
Indiana Science Indicator 5.2.6Indiana Science Indicator 5.2.6
Indiana Science Indicator 5.2.6
 
Mosep ICL08, eP08
Mosep ICL08, eP08Mosep ICL08, eP08
Mosep ICL08, eP08
 
Free Scrabble Coaching Camp on Oct 24th/25th 2011
Free Scrabble Coaching Camp on Oct 24th/25th 2011Free Scrabble Coaching Camp on Oct 24th/25th 2011
Free Scrabble Coaching Camp on Oct 24th/25th 2011
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 
Panevėžio juozo miltinio
Panevėžio juozo miltinioPanevėžio juozo miltinio
Panevėžio juozo miltinio
 
My twitter account
My twitter accountMy twitter account
My twitter account
 
Conventions of a magazine
Conventions of a magazineConventions of a magazine
Conventions of a magazine
 
Transport services in pune
Transport services in puneTransport services in pune
Transport services in pune
 
H2+landschap+nederland+2 kgt+par+6 7
H2+landschap+nederland+2 kgt+par+6 7H2+landschap+nederland+2 kgt+par+6 7
H2+landschap+nederland+2 kgt+par+6 7
 
Informe lab 2_hidraulica_mbreytmann (2)
Informe lab 2_hidraulica_mbreytmann (2)Informe lab 2_hidraulica_mbreytmann (2)
Informe lab 2_hidraulica_mbreytmann (2)
 
Морской фасад в контексте Одессы
Морской фасад в контексте ОдессыМорской фасад в контексте Одессы
Морской фасад в контексте Одессы
 
Учи неучёного
Учи неучёногоУчи неучёного
Учи неучёного
 
Censored Ad Of Mtv
Censored Ad Of MtvCensored Ad Of Mtv
Censored Ad Of Mtv
 
Zine
ZineZine
Zine
 
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE Equalizer
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE EqualizerPerformance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE Equalizer
Performance Analysis of OSTBC MIMO Using Precoder with ZF & MMSE Equalizer
 
孫越的甦醒
孫越的甦醒孫越的甦醒
孫越的甦醒
 
Sustainability Club Presn
Sustainability Club PresnSustainability Club Presn
Sustainability Club Presn
 
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...
Guidelines siting sharingb_bts ruanda PRAVILNIK O POZICIONIRANJU I RAZMEŠTANJ...
 
Saving Struggling Quality Teams
Saving Struggling Quality TeamsSaving Struggling Quality Teams
Saving Struggling Quality Teams
 
HL15033_brochure
HL15033_brochureHL15033_brochure
HL15033_brochure
 

Similar to Fewd week4 slides

Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | IntroductionJohnTaieb
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.jsShakti Shrestha
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17Jared Faris
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernizationdevObjective
 
Basics java scripts
Basics java scriptsBasics java scripts
Basics java scriptsch samaram
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupalBlackCatWeb
 
Going open source with small teams
Going open source with small teamsGoing open source with small teams
Going open source with small teamsJamie Thomas
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdfradhianiedjan1
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy Miles
 

Similar to Fewd week4 slides (20)

Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Java script hello world
Java script hello worldJava script hello world
Java script hello world
 
Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.js
 
Web summit.pptx
Web summit.pptxWeb summit.pptx
Web summit.pptx
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Basics java scripts
Basics java scriptsBasics java scripts
Basics java scripts
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
 
Going open source with small teams
Going open source with small teamsGoing open source with small teams
Going open source with small teams
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 

More from William Myers

More from William Myers (8)

Fewd week8 slides
Fewd week8 slidesFewd week8 slides
Fewd week8 slides
 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slides
 
Fewd week6 slides
Fewd week6 slidesFewd week6 slides
Fewd week6 slides
 
Fewd week5 slides
Fewd week5 slidesFewd week5 slides
Fewd week5 slides
 
Fewd week3 slides
Fewd week3 slidesFewd week3 slides
Fewd week3 slides
 
Fewd week2 slides
Fewd week2 slidesFewd week2 slides
Fewd week2 slides
 
Fewd week1 slides
Fewd week1 slidesFewd week1 slides
Fewd week1 slides
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 

Recently uploaded

Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 

Recently uploaded (20)

Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 

Fewd week4 slides

  • 1. IMPORTANT NOTICE Next week, students will be required to hand in wireframes for their final projects. You can create wireframes using tools like Balsamiq Mockups, Sketch or just plain old pen and paper. Previous FEWD projects from around the world are here: https://gallery.generalassemb.ly/FEWD
  • 2. FEWD - WEEK 4 WILL MYERS Freelance Front End Developer SLIDES http://www.slideshare.net/wilkom/fewd-week4-slides
  • 3. YOUR WEEKLY FEWD GITHUB REPOSITORY Use the '+' button in the top-left of GitHub Desktop (Create tab) Create a new repository called 'FEWD_Week4' Choose the [home]/FEWD folder for the local path Open this repo folder in your editor Commit the changes and publish the FEWD_Week4 repository to github.com
  • 4. YOUR WEEKLY WORKING FILES FROM ME To get the week4_working_files you should just be able to select the ga-fewd-files repository in GitHub Desktop and press 'Sync'. This should pull in this weeks folder from github.com. If you any difficulties you should just re-clone the ga-fewd- files repository. Copy the whole week4_working_files into your FEWD_Week4 repository and commit and publish to github.com
  • 5. AGENDA Introduction To Programming What JS Can Do Reading JS Lab
  • 6. ASSIGNMENT FOR TODAY Continue with Relaxr using JavaScript and jQuery Also...
  • 7. IMPORTANT NOTICE Next week, students will be required to hand in wireframes for their final projects. You can create wireframes using tools like Balsamiq Mockups, Sketch or just plain old pen and paper. Previous FEWD projects from around the world are here: https://gallery.generalassemb.ly/FEWD
  • 8. INTRODUCTION TO PROGRAMMING So far we have looked at HTML as a markup language, and CSS as a styling language. We now want to think about a programming language so that we can get the computer to perform tasks.
  • 9. INTRODUCTION TO PROGRAMMING The computer will do what you tell it to do.
  • 10. WHAT IS A PROGRAM A program is a set of instructions that you write to tell a computer what to do
  • 11. WHAT IS PROGRAMMING Programming is the task of writing those instructions in a language that the computer can understand.
  • 12. BECOMING A PROGRAMMER At the beginning, it isn't about the programming language. It is about changing how you think. We have to know how the computer thinks to change how we think.
  • 13. HOW COMPUTERS 'THINK' The short answer is that they don't think. The slightly longer answer is that while computers donâ​​t think, they act as if they do, by sequentially executing simple instructions. The only things a computer knows are the things we tell it.
  • 14. PSEUDO CODE Pseudocode is the process of writing a program without using the syntax of a programming language. Pseudocode is a mixture of natural language and high-level programming constructs. For example, If the door is closed and I want to exit the room, then open the door We can pseudocode to train our brain for programming.
  • 15. PSEUDO CODE In pseudocode we can introduce simple bits of programming syntax and naming conventions. join meaningful words together with underscores to imply a computer task or some computer data e.g. my_email_inbox use verbs to imply a computer task (action): e.g. get_my_email use some high-level programming syntax like if...thenor repeat use simple arithmetic operators like =(assignment), == (equals), <(less than), >(greater than)
  • 16. THERMOSTAT PSEUDOCODE Let's try and write the pseudocode for a thermostat that controls a heater what data do we need to know from the thermostat? what actions do we want to be able to do with the heater? how often should we be performing our actions?
  • 17. THERMOSTAT PSEUDOCODE get target_temperature target_temperature = 72 repeat forever, current_temperature = get_sensor_reading if target_temperature > (current_temperature+5), turn_on_heater if target_temperature <= current_temperature, turn_off_heater
  • 18. ROCK PAPER SCISSORS PSEUDOCODE What does each thing have in common with the other two? What happens each time a turn takes place? What happens each time that is different? What happens each time that is the same?
  • 19. WHAT IS JAVASCRIPT JavaScript is the behaviour of a web site. HTML - Document Structure CSS - Looks, Style JavaScript - Logic, Functionality, Behavior It is historically seen as wrong to mix these things up. Putting things where they belong reduces complexity and increases maintainability. However some new JS frameworks are challenging this way of thinking.
  • 20. JAVASCRIPT AND THE DOM JavaScript in the browser has an API (application program interface) for accessing and editing the DOM (the document object model) of an HTML document. The DOM is a hierarchical tree representation of the structure of the HTML. JavaScript can target specific elements on an HTML page and show, hide, style, edit and animate them. It can also listen for events emitted by an HTML page (e.g mouse-clicks) and invoke functions when an event occurs.
  • 21. WHAT CAN JAVASCRIPT DO? Front-end website logic - user input event handling, dynamically applying styles <canvas>, <audio>, <video> Server-side NodeJS WebGL (works in Firefox) https://developer.mozilla.org/samples/video/chroma- key/index.xhtml http://mdn.github.io/canvas-raycaster/ http://webaudiodemos.appspot.com/wubwubwub/index.ht ml http://threejs.org/examples/
  • 22. COLOR SWITCHER Open week4_working_files/color_scheme_switcher Let's think about the control flow of a program. We will think in a more high-level way about coding at first. JavaScript syntax will come later.
  • 23. COLOR SWITCHER - CONTROL FLOW In computer science, control flow (or alternatively, flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. [Wikipedia] In js/index.jstry moving the <script>link for the JavaScript out of the <body>and into the <head>. What is happening in js/index.js?
  • 24. EVENTS An event is something that happens that other things can respond to. An object triggers an event, and an event listener (or handler) fires when the event is triggered. E.g. the clickevent occurs when the user clicks on an element. An event and event listener are an implementation of the Observer pattern - a pattern is a recognised and repeated way of programming. The Observer pattern involves an observable object (which triggers the event) and an observer listener (which responds to the event).
  • 25. TRAFFIC LIGHT Go to this CodePen: http://codepen.io/nevan/pen/shtLA The green light does not work. Change the code so that the traffic light works correctly.
  • 26. AGENDA AFTER LUNCH Intro To Programming Reivew Intro To jQuery jQuery Basics File Structure Syntax Adding Interactivity
  • 27. INTRO TO PROGRAMMING REVIEW Any questions?
  • 28. INTRO TO JQUERY jQuery is a cross-browser JavaScript library, designed to simplify front-end JavaScript web programming. jQuery is written in JavaScript.
  • 29. JQUERY jQuery is designed to make the following things easier: Document traversal Modify the appearance of the page (CSS Manipulation) Edit the page content Respond to user interaction (Event Handling) Add animation Retrieve data from a server using AJAX (Asynchronous JavaScript and XML) Simplify common JavaScript tasks
  • 30. JQUERY jQuery also provides the following useful features: uses CSS selector syntax supports extensions abstracts away browser quirks allows multiple actions to be defined in one line with chaining
  • 31. JQUERY VS VANILLA JS Open week4_working_files/styling-css-with-jquery and week4_working_files/styling-css-with-js The advantages of jQuery for a new programmer is that there is less code to right, it is somewhat easier to read and understand, and it is cross-browser compatible.
  • 32. DISADVANTAGES OF JQUERY The two main downsides to using the jQuery library are: it is an additional file download which will delay rendering your website for the first time it is an abstraction which has slower performance than using native functionality.
  • 33. DO WE NEED JQUERY? jQuery is a mature and robust library that provides cross- browser compatibility for a wide range of tasks. This has made it very popular over the years, particularly when supporting browsers like IE. But browsers are evolving and it is now possible to use native JavaScript APIs that are much faster and have good support across newer browsers. For example document.querySelectorand document.querySelectorAllallow selecting elements from the DOM with CSS selector syntax and are now relatively mature.
  • 34. DO WE NEED JQUERY? jQuery is still an important library, particularly for a new web programmer. Its maturity and cross-browser compatibility are still essential for many web sites. So it is still worth learning. But remember that you can and will eventually do more JavaScript without an abstraction like jQuery. jQuery will slowly become less important as native browser functionality matures over time. (Keep this link open)http://youmightnotneedjquery.com/ http://stackoverflow.com/questions/11503534/jquery-vs- document-queryselectorall
  • 35. JS/JQUERY BASICS Saying all that, this week we'll use jQuery to add JavaScript to our web pages. Because it is easier, we can use it as a stepping stone to using vanilla JavaScript.
  • 36. JQUERY SCRIPT TAGS Adding jQuery script tag to your website // Adding the file. <script src="js/jquery-1.8.3.min.js"></script> // linking the library from a CDN <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
  • 37. SYNTAX Syntax: Spelling and grammar rules of a programming language. We will look at jQuery syntax and some basic JS syntax first. We will look further at vanilla JavaScript syntax next week. Like with any language, there are formal rules around how to write it. This is the syntax.
  • 38. BASIC JAVASCRIPT SYNTAX - PUNCTUATION Semicolon ;- should come at the end of an Curly Braces {}- denotes a block of code e.g a function or an object literal Parentheses ()- used to invoke (call) a function, or to evaluate part of an expression Quotation Marks ""- contains a string of text, e.g. "Hello World!" expression
  • 39. BASIC JAVASCRIPT SYNTAX - COMMENTS //Single Line Comments /* Multi line comments */ Use Cmd + / in your text editor to toggle comments, same as for CSS and HTML
  • 40. JQUERY SYNTAX $ DOLLAR SYMBOL When you import the jQuery library into your web page the dollar $symbol by default becomes a global identifier (global variable) for jQuery. It is possible to change this, as the dollar symbol is used widely in different programming languages and libraries. But most jQuery implementations on the front-end stick with the $, and we will too.
  • 41. JQUERY SYNTAX $ DOLLAR SYMBOL With jQuery firstly you select a DOM element (DOM traversal) and it gets wrapped in a jQuery object. Then you invoke a method on this object which does something to the selected element, e.g. changes what it looks like, or adds some user interaction logic. $("selector").method(argument)
  • 42. JQUERY SYNTAX - SELECTORS Selectors are just like CSS For selecting an element in the DOM, just use the $followed by parentheses (invocation). The parentheses contain a string as an argument. This string is a CSS selector. $("#id") $(".class") $("main")
  • 43. JQUERY SYNTAX - METHODS To invoke a method on your jQuery-selected element you use dot syntax, following the selector expression. You pass further arguments into your method invocation. E.g. You can change the CSS style on a selected item with the $.css()method. $("main").css("border", "10px solid black");
  • 44. JQUERY CLICK EVENT https://api.jquery.com/click/ $(myElement).click(someFunction) This is used for triggering a function call when a user clicks on an element. It is a short-form of a more generic jQuery syntax: .on( "click", handler ). $('selector').click(doSomething); function doSomething() { // make something happen here } What's the syntax for a click event handler in vanilla JS?
  • 45. JQUERY SYNTAX - SOME MORE METHODS .click .slideToggle() .hide() .show() .slideUp() .slideDown() .children() .attr() You can look them up at https://api.jquery.com/
  • 46. JQUERY TRAFFIC LIGHT Let's 'jQueryify' our traffic light example. Open up week4_working_files/jquery_traffic_light_exercise We can also try and 'jQueryify' the color_scheme_switcher we looked at earlier. Create a new index_jq.jsfile in week4_working_files/color_scheme_switcher/js and link this into the html file instead of index.js.
  • 47. JQUERY BREAKDOWN Let's have a look at what was actually happening in the scrolling page anchor links example from Week 2. Open up week4_working_files/jquery_scrolling_link
  • 48. SYNTAX DRILL Fork this CodePen: http://codepen.io/GeneralAssembly/pen/EAubl Try and do the following: Use jQuery syntax to change all p tags to blue. Use jQuery to change the size of the boxes etc. |
  • 49. ADDING INTERACTIVITY http://codepen.io/nevan/pen/mKzvs Play around with this code, so you understand what is happening.
  • 50. TRIGGERING ANIMATIONS IN VANILLA JS Open up week4_working_files/scroll_animated_header. This is vanilla JavaScript, can you understand what is going on?
  • 51. A SIMPLE GAME ROCK PAPER SCISSORS GAME IN VANILLA JS Open up week4_working_files/rock_paper_scissors Can you make the game result display in some text in the page rather than in an alert box?