CMPE 280 Web UI Design and Development November 7 Class Meeting

Slides:



Advertisements
Similar presentations
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
Advertisements

The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
CSS Styling CSS Box Model & CS110: Computer Science and the Internet.
Chapter 6 More CSS Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Slide 1 CMPS 211 Internet Programming Spring 2008 Dynamic Effects with Styles Chapter 12 2/6/08.
Very quick intro HTML and CSS. Sample html A Web Title.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
End User Computing An Introduction to CSS Sujana Jyothi Research Lab1, Callan Building, Department of Computer Science
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
1 Dreamweaver CS5 intermediate class by Cookie Setton Build a CSS website WITHOUT TABLES Just when you thought you were starting to understand HTML coding,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Cascade Style Sheet Demo. Cascading Style Sheets Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
Unit 20 - Client Side Customisation of Web Pages
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
HTML. Goals How to use the Komodo editor HTML coding and testing – List and Images – Tables and Links – At least 2 pages and navigation –
Tutorial 6 Creating Tables and CSS Layouts. Objectives Session 6.1 – Create a data table to display and organize data – Modify table properties and layout.
CS 174: Web Programming September 30 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Microsoft Expression Web-Illustrated Unit F: Enhancing a Design with CSS.
Web Authoring Task 8– Create the following Style Sheet: 1.Create a new CSS called Tiger.CSS Style Sheet Body Horizontal Tile using the Tiger.JPG H1 Browsers.
 Add one element at a time  If it doesn’t do what you want, › Delete it › DON’T just keep piling on more items.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Create a new stylesheet called Hotel Style
Internet & Web Engineering Course Code:CS-228 Credit Hours (3+1) Lab 2 HTML TABLES Instructor: Muhammad Zeeshan Haider Ali Blog Address:
Semester - Review.
Google fonts CSS box model
CSS Layouts: Grouping Elements
Unit 3 - Review.
Creating Your Own Webpage
Creating Page Layouts with CSS
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Chapter 5 Introduction to XHTML: Part 2
Chapter 7 Tables.
Chapter 5 - Introduction to XHTML: Part 2
CMPE 280 Web UI Design and Development November 7 Class Meeting
Web Development & Design Foundations with HTML5 7th Edition
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
Chapter 6 More CSS Basics Key Concepts
PAGE LAYOUT - 2.  The div tag equipped with CSS rules produces good looking pages.  With CSS, the div tag can easily be positioned anywhere on the page.
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
Web Authoring Task 8– Create the following Style Sheet:
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
The Internet 10/13/11 The Box Model
For the World Wide Web Positioning Objects with CSS
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
DynamicHTML Cascading Style Sheet Internet Technology.
CMPE 280 Web UI Design and Development September 4 Class Meeting
For the World Wide Web Styling Tables with CSS
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
Web Programming Language
DynamicHTML Cascading Style Sheet Internet Technology.
How to use the CSS box model for spacing, borders, and backgrounds
CMPE 280 Web UI Design and Development February 7 Class Meeting
HTML5 and Local Storage.
Principles of Web Design 5th Edition
CMPE 280 Web UI Design and Development April 23 Class Meeting
Transitioning Opacity
Session IV Chapter 15 - How Work with Fonts and Printing
CMPE 280 Web UI Design and Development November 8 Class Meeting
CMPE 280 Web UI Design and Development September 5 Class Meeting
CGS 3066: Web Programming and Design Fall 2019 CSS Extra
Presentation transcript:

CMPE 280 Web UI Design and Development November 7 Class Meeting Department of Computer Engineering San Jose State University Fall 2017 Instructor: Ron Mak www.cs.sjsu.edu/~mak

AngularJS Tables TablesStyles.css table {     font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; } table, th, td {     border: 1px solid grey;     border-collapse: collapse;     padding: 5px; table th {     padding-top: 12px;     padding-bottom: 12px;     text-align: left;     background-color: #4CAF50;     color: white; table tr:nth-child(odd) {     background-color: #f2f2f2;

AngularJS Tables, cont’d Table.html <head>     <link rel="stylesheet" href="TableStyles.css" />     <script src="public/angular/angular.min.js"></script>     <script src="PersonController.js"></script>          <script>         angular.module('myApp', [])                .controller('customersCtrl', function($scope)          {              $scope.names = [                  {name:'Jani',country:'Norway'},                  {name:'Carl',country:'Sweden'},                  {name:'Margareth',country:'England'},                  {name:'Hege',country:'Norway'},                  {name:'Joe',country:'Denmark'},                  {name:'Gustav',country:'Sweden'},                  {name:'Birgit',country:'Denmark'},                  {name:'Mary',country:'England'},                  {name:'Kai',country:'Norway'}              ];         });     </script> </head>

AngularJS Tables, cont’d Table.html <body>     <div ng-app="myApp" ng-controller="customersCtrl">         <table>             <tr>                 <th>Name</th>                 <th>Country</th>             </tr>             <tr ng-repeat="x in names | orderBy:'country'">                 <td> {{ x.name }} </td>                 <td> {{ x.country }} </td>        </table>     </div> </body>

AngularJS Events ng-blur ng-change ng-click ng-copy ng-cut ng-dblclick ng-focus ng-keydown ng-keypress ng-keyup ng-mousedown ng-mouseenter ng-mouseleave ng-mousemove ng-mouseover ng-mouseup ng-paste

AngularJS Events, cont’d Events.html <head>     <script src="public/angular/angular.min.js"></script>     <script>         angular.module('myApp', [])                .controller('myCtrl', function($scope)          {             $scope.count = 0;         });     </script> </head> <body>     <div ng-app="myApp" ng-controller="myCtrl">         <h1 ng-mousemove="count = count + 1">Mouse over me!</h1>         <h2>{{ count }}</h2>     </div> </body>

Forms: Checkbox FormCheckbox.html <head>     <script src="public/angular/angular.min.js"></script> </head> <body>     <div ng-app="">         <h2>Check to see a secret message:</h2>         <form>             <input type="checkbox" ng-model="myVar">         </form>         <h1 ng-show="myVar">See this only when checked.</h1>     </div> </body> The ng-show attribute is true only when the checkbox is checked.

Forms: Radio Buttons FormRadio.html <body ng-app="">     <h1>Pick a topic:</h1>     <form>         <input type="radio" ng-model="myChoice" value="dogs">Dogs         <input type="radio" ng-model="myChoice" value="cats">Cats         <input type="radio" ng-model="myChoice" value="bunnies">Bunnies     </form>          <div ng-switch="myChoice">         <div ng-switch-when="dogs">             <h1>Dogs</h1>             <h2>Welcome to a world of dogs.</h2>         </div>         <div ng-switch-when="cats">             <h1>Cats</h1>             <h2>Read about cats.</h2>         <div ng-switch-when="bunnies">             <h1>Bunnies</h1>             <h2>Bunnies are fun!</h2>     </div> </body> FormRadio.html

Forms: Selection FormSelect.html <body ng-app="">     <h1>Pick a topic:</h1>     <form>         <select ng-model="myChoice">             <option value="">             <option value="dogs">Dogs             <option value="cats">Cats             <option value="bunnies">Bunnies         </select>     </form>          <div ng-switch="myChoice">         <div ng-switch-when="dogs">             <h1>Dogs</h1>             <h2>Welcome to a world of dogs.</h2>         </div>         <div ng-switch-when="cats">             <h1>Cats</h1>             <h2>Read about cats.</h2>         <div ng-switch-when="bunnies">             <h1>Bunnies</h1>             <h2>Bunnies are fun!</h2>     </div> </body>

Animation To do AngularJS animation, you need the Angular animation library angular-animate.js Download from https://code.angularjs.org/1.6.6/ Or get it from Google: Do animated transitions using CSS styles. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-animate.js"> </script>

Animation, cont’d AnimationStyles.css div {     font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;     transition: all linear 0.5s;     background-color: lightblue;     height: 100px;     width: 100%;     position: relative;     top: 0;     left: 0; } .ng-hide {     height: 0;     width: 0;     background-color: transparent;     top:-200px;     left: 200px;

Animation, cont’d Animation.html <head>     <link rel="stylesheet" href="AnimationStyles.css" />     <script src="https://ajax.googleapis.com/ ... /angular.min.js">     </script>     <script src="https://ajax.googleapis.com/ ... /angular-animate.js">          <script>         var app = angular.module('myApp', ['ngAnimate']); </head> <body ng-app="myApp">     <h2>         <label>Hide/unhide:</label>          <input type="checkbox" ng-model="myCheck">     </h2>     <div ng-hide="myCheck">         <h1>Check the box to hide or unhide me!</h1>     </div> </body> The module depends on ngAnimate.

AngularJS Routing AngularJS provides routing that allows a user to navigate from one web page to another in the browser, without accessing the server. This enables your web app to be a single-page application (SPA). Use the ngRoute module to route to different pages without reloading pages.

AngularJS Routing, cont’d To do AngularJS routing, you must include the AngularJS Route module angular-route.js. Download from https://code.angularjs.org/1.6.6/ Or get it from Google: Your app module must depend on ngRoute: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"> </script> angular.module("myApp", ["ngRoute"]);

AngularJS Routing, cont’d Use the $routeProvider to configure different routes in your application. You can define what page to display when a user clicks a link. The ng-view directive provides a container for the content provided by the routing. Your app can have only one ng-view directive. This will be the placeholder for all views provided by the route.

AngularJS Routing, cont’d Routing1.html <head>     <script src="https://ajax.googleapis.com/ ... /angular.min.js"></script>     <script src="https://ajax.googleapis.com/ ... /angular-route.js"></script>     <script>         var app = angular.module("myApp", ["ngRoute"]);         app.config(function($routeProvider)          {             $routeProvider             .when("/", {                 templateUrl : "main.htm"             })             .when("/london", {                 templateUrl : "london.htm"             .when("/paris", {                 templateUrl : "paris.htm"             });         });     </script> </head> The module depends on ngRoute.

AngularJS Routing, cont’d Routing1.html <body ng-app="myApp">     <p><a href="#/!">Main</a></p>          <a href="#!london">London</a>     <a href="#!paris">Paris</a>     <p>Click on the links to read about London and Paris.</p>     <div ng-view></div> </body>

AngularJS Routing, cont’d <h1>Main</h1> main.htm <h1>London</h1> <h3>London is the capital city of England.</h3> <p>     It is the most populous city in the United Kingdom,      with a metropolitan area of over 13 million inhabitants. </p> <p>{{msg}}</p> london.htm <h1>Paris</h1> <h3>Paris is the capital of France.</h3> <p>     The Paris area is one of the largest population centers      in Europe, with more than 12 million inhabitants. </p> <p>{{msg}}</p> paris.htm

AngularJS Routing, cont’d Use the templateUrl property on the $routeProvider.when method to specify the URL of a page. Use the template property to insert HTML directly without going to a page. Use the otherwise property to specify a default route. You can give each view its own controller.

AngularJS Routing, cont’d Routing2.html     <script>         var app = angular.module("myApp", ["ngRoute"]);         app.config(function($routeProvider)          {             $routeProvider             .when("/", {                 templateUrl : "main.htm"             })             .when("/london", {                 templateUrl : "london.htm",                 controller  : "londonCtrl"             .when("/paris", {                 templateUrl : "paris.htm",                 controller  : "parisCtrl"             });         });         app.controller("londonCtrl", function ($scope)              $scope.msg = "I love London!";         app.controller("parisCtrl", function ($scope)              $scope.msg = "J'aime Paris!";     </script>

SPA Example: Shopping List A single-page AngularJS application that manages a shopping list. Add new items to the list. Don’t allow duplicate items. Remove items from the list.

SPA Example: Shopping List, cont’d angular.module("myShoppingList", [])        .controller("myCtrl", function($scope)  {     // Initial list of items.     $scope.products = ["Milk", "Bread", "Cheese"];          $scope.addItem = function()      {         $scope.errortext = "";         if (!$scope.addMe) return;  // add item is empty                  // Add the item to the list if it's not already there.         if ($scope.products.indexOf($scope.addMe) == -1) {             $scope.products.push($scope.addMe);         }          else {             $scope.errortext =                  "The item is already in your shopping list.";         }     } ShoppingList.js

SPA Example: Shopping List, cont’d     $scope.removeItem = function(x)      {         $scope.errortext = "";             $scope.products.splice(x, 1);     } }); ShoppingList.js

SPA Example: Shopping List, cont’d ShoppingSPA.html <head>     <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">     <script src="https://ajax.googleapis.com/ ... /angular.min.js"></script>     <script src="ShoppingList.js"></script> </head> <body>     <div ng-app="myShoppingList"           ng-cloak ng-controller="myCtrl"           class="w3-card-2 w3-margin"           style="max-width:400px;">         <header class="w3-container w3-light-grey w3-padding-16">             <h3>My Shopping List</h3>         </header> ... </div> </body>

SPA Example: Shopping List, cont’d ShoppingSPA.html <body>     <div ng-app="myShoppingList" ... >  ...         <ul class="w3-ul">             <li ng-repeat="p in products"                  class="w3-padding-16">                 {{p}}                 <span ng-click="removeItem($index)"                        style="cursor:pointer;"                        class="w3-right w3-margin-right">                     ×                 </span>             </li>         </ul> </div> </body> Shopping list

SPA Example: Shopping List, cont’d <body>     <div ng-app="myShoppingList" ... >  ...         <div class="w3-container w3-light-grey w3-padding-16">             <div class="w3-row w3-margin-top">                 <div class="w3-col s10">                     <input placeholder="Add shopping items here"                             ng-model="addMe"                             class="w3-input w3-border w3-padding">                 </div>                 <div class="w3-col s2">                     <button ng-click="addItem()"                              class="w3-btn w3-padding w3-green">                         Add                     </button>             </div>                          <p class="w3-text-red">{{errortext}}</p>         </div> </div> </body> ShoppingSPA.html Text input for item to add. Green add button. Error message.