190 likes | 357 Views
Advanced Web Art and Design, CSS and JavaScript Frameworks. CSDM 2N15 CHRIS K KIM WEEK 3 CONTINUING STUDIES OCAD UNIVERSITY. HTML page is simply a text file with special declarations and tags CSS is a document that describes the tags placed in the HTML
E N D
Advanced Web Art and Design, CSS and JavaScript Frameworks CSDM 2N15 CHRIS K KIM WEEK 3 CONTINUING STUDIES OCAD UNIVERSITY
HTML page is simply a text file with special declarations and tags • CSS is a document that describes the tags placed in the HTML • JS is a programming language for the web, designed to manipulate static web pages and enhance UI • jQuery facilitates Javascript development with easy-to-use commands and logics REVIEW
Basic trinity of HTML-CSS-JS • Overview of CSS3 • Sample of different CSS3 properties • Advantages and drawbacks REVIEW
jQuery concept review • “Functions” and “triggers” are the main components of any jQuery code • No function can run without a trigger • $(document).ready() is a global function – “when the document is ready” • Meaning that all functions in this trigger will run immediately REVIEW
AJAX: Asynchronous Javascript and XML • Not a programming language, but a way of using one • Technique for creating fast dynamic pages • Change parts of the website by loading external content REVIEW
Programming language for the Web – one of integral components in Web development • Other programming languages: C++, Visual Basic, Perl, PHP • Little to no relationship to Java • Created by Netscape (precursor to Mozilla), originally called LiveScript • Heavy on processing power at the time – virtually unusable • Not adopted by Microsoft until Internet Explorer 3.0, called Jscript • Finally standardized under the name ECMAscript • Also the foundation for ActionScript, language for Adobe Flash • Originally avoided by developers • Open source in nature / “amateur language” • With the advent of AJAX, it has become the dominant script language • Movement to bring JavaScript to other platforms • With the rise of Google Chrome and its V8 engine, other companies are striving to optimize for JS • https://www.youtube.com/watch?v=nCgQDjiotG0 BACK TO JAVASCRIPT
Easy to learn • Source of ridicule from other programmers, due to its name and fluid structure • Success of AJAX – loading elements after the initial compiling • Not as strict as other languages • Gateway to different programming languages • Gets the basic concepts right • Introduction to other programming languages • “The World’s Most Misunderstood Programming Language” • http://www.crockford.com/javascript/javascript.html • Most popular programming language in the world • http://redmonk.com/sogrady/2012/09/12/language-rankings-9-12/ Why learn JavaScript?
No design elements, simply dealing with input, output, and underlying logics • Need to understand the logic, then manipulate HTML elements via jQuery • Going to use regular JavaScript for lessons, and will output the results using jQuery Our procedure for JS EXERCISE
Semicolon separates JS statements • JS is case-sensitive • JS ignores extra spaces • One can comment by using “//” or using “/*” and “*/” – for references or disabling JS statements JS BASIC STATEMENTS
“Containers” for storing information • Text, numbers, etc. • var x = “hello”; • var y = x+” world”; • Dynamic type – meaning that string can turn into number or vice versa if the need arises • Boolean: true or false • Arrays: Two dimensional list of items • Objects: One object, many properties • Undefined and null: no value or not defined VARIABLES
Block of code that is executed based on trigger • Basic syntax, no argument, one or more arguments, return value • Local and global variable FUNCTIONS
Used for adding/subtracting numbers, or adding strings • Addition, subtraction, multiplication, division, modulus, increment, decrement, etc. • Comparing variables in conditional statements • Equal to, is not equal, greater than, less than, etc. OPERATORS AND COMPARISONS
Different actions based on different situations • IF, ELSE, ELSE IF, SWITCH CONDITIONALS
FOR: between number X and Y • (statement 1, 2, 3: var i=0; i<5; i++) • FOR/IN • for (x in person) { txt=txt + person[x]; } • WHILE: run if the condition is true • jQuery loop: $.each(array, function(i, v) { }) • Use “break” to get out of the loop without finishing it • Use “continue” to skip to the next iteration LOOP STATEMENTS
Catching errors by “trying” and “catching” • try { catch(err) { } }; TRY AND CATCH
jQuery is simply a library for JavaScript • You can (or must) mix jQuery statements with JavaScript • Especially for conditional and loops MIXING JS WITH JQUERY
Codeacademy • jsFiddle • Google Inspect Element • W3Schools TOOLS AND RESOURCES
Making a variable based on jQuery object • Inserting a variable into a jQuery object • Adding two variables based on jQuery objects • Creating a function and attaching it to various jQuery object/triggers • Creating an array based on jQuery objects • Inserting jQuery functions in conditionals • Inserting jQuery functions in loops sTEP-BY-STEPEXERCISE
Advanced Web Art and Design, CSS and JavaScript Frameworks CSDM 2N15 CHRIS K KIM WEEK 3 CONTINUING STUDIES OCAD UNIVERSITY