Скачать презентацию Java Script frameworks Ivan Chyr Frameworks overview Скачать презентацию Java Script frameworks Ivan Chyr Frameworks overview

01_jQuery_pres.ppt

  • Количество слайдов: 24

Java. Script frameworks Ivan Chyr Java. Script frameworks Ivan Chyr

Frameworks overview • j. Query - j. Query is a fast and concise Java. Frameworks overview • j. Query - j. Query is a fast and concise Java. Script Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. • Ext. JS - Ext JS is a Java. Script framework for building rich internet applications that work in any web browser. • YUI - The YUI Library is a set of utilities and controls, written with Java. Script and CSS, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. • MVC: Java. Script. MVC, Spine, Backbone

What is j. Query? • j. Query is Java. Script. • It’s lightweight library What is j. Query? • j. Query is Java. Script. • It’s lightweight library (32 kb minified and GZIPed) • Easy and fast HTML DOM Selection • Built to work on all modern browsers ( IE 6+, FF 2. 0+, Safari 3. 0+, Opera 9+, Chrome 1. 0+ ) • It’s Open Source www. bestjquery. com

 if ( browser. Type == “gecko” ) document. popped. Layer =eval(‘document. get. Element. if ( browser. Type == “gecko” ) document. popped. Layer =eval(‘document. get. Element. By. Id(“Hidden. DIV”)’); else if ( browser. Type == “ie” ) document. popped. Layer =eval(‘document. get. Element. By. Id(“Hidden. DIV”)’); else document. popped. Layer =eval(‘document. layers[“Hidden. DIV”]’); Document. popped. Layer. style. visibility = “visible”;

 • That was Java. Script way…. • j. Query does this in this • That was Java. Script way…. • j. Query does this in this manner: $(“#Hidden. DIV”). show();

2. Using j." src="https://present5.com/presentation/3/20401202_173584951.pdf-img/20401202_173584951.pdf-6.jpg" alt="<< Installation >> 1. Referencing to downloaded library 2. Using j." /> << Installation >> 1. Referencing to downloaded library 2. Using j. Query from other sites (e. g. Google, Microsoft, etc. )

j. Query Philosophy 1. Find some HTML 2. Do something with it j. Query Philosophy 1. Find some HTML 2. Do something with it

Syntax Basic syntax is: $(selector). action() : • A $ sign to define/access j. Syntax Basic syntax is: $(selector). action() : • A $ sign to define/access j. Query • A (selector) to "query (or find)" HTML elements • A j. Query action() to be performed on the element(s)

Syntax : : : example 1 • $(this). hide() - hides the current element Syntax : : : example 1 • $(this). hide() - hides the current element • $("p"). hide() - hides all

elements • $(". test"). hide() - hides all elements with class="test“ • $("#test"). hide() - hides the element with id="test“ Simple. Selectors. html

Syntax : : : selectors Syntax Description $( Syntax : : : selectors Syntax Description $("*") Selects all elements $(this) Selects the current HTML element $("p. intro") Selects all

elements with class="intro" $("p: first") Selects the first

element $("ul li: first") Selects the first

  • element of the first
  • Syntax : : : running code after document load $(document). ready(function(){ // j. Query Syntax : : : running code after document load $(document). ready(function(){ // j. Query methods go here. . . });

    Syntax : : : j. Query methods • Moving Elements append(), append. To(), before(), Syntax : : : j. Query methods • Moving Elements append(), append. To(), before(), after() • Attributes css(), attr(), html(), val(), add. Class() • Events bind(), trigger(), unbind(), live(), click() • Effects show(), fade. Out(), toggle(), animate() • Traversing find(), is(), prev. All(), next(), has. Class() • Ajax get(), get. JSON(), post(), ajax(), load()

    Syntax : : : events Event Method Description $(document). ready(function) Binds a function to Syntax : : : events Event Method Description $(document). ready(function) Binds a function to the ready event of a document (when the document is finished loading) $(selector). click(function) Triggers, or binds a function to the click event of selected elements $(selector). dblclick(function) Triggers, or binds a function to the double click event of selected elements $(selector). focus(function) Triggers, or binds a function to the focus event of selected elements $(selector). mouseover(function) Triggers, or binds a function to the mouseover event of selected elements

    Syntax : : : effects animate(), clear. Queue(), delay(), dequeue(), fade. In(), fade. Out(), Syntax : : : effects animate(), clear. Queue(), delay(), dequeue(), fade. In(), fade. Out(), fade. Toggle(), fade. In(), fade. Out(), hide(), queue(), show(), slide. Down(), slide. Toggle(), slide. Up(), slide. Down(), slide. Up(), stop(), toggle() Effects. html

    Syntax : : : DOM manipulation • text() - Sets or returns the text Syntax : : : DOM manipulation • text() - Sets or returns the text content of selected elements • html() - Sets or returns the content of selected elements (including HTML markup) • val() - Sets or returns the value of form fields • attr() - gets attribute values

    Adding new HTML content: • append() - Inserts content at the end of the Adding new HTML content: • append() - Inserts content at the end of the selected elements • prepend() - Inserts content at the beginning of the selected elements • after() - Inserts content after the selected elements • before() - Inserts content before the selected elements • remove() - Removes the selected element (and its child elements) • empty() - Removes the child elements from the selected element DOMmanipulation. html

    Syntax : : : CSS • add. Class() - Adds one or more classes Syntax : : : CSS • add. Class() - Adds one or more classes to the selected elements • remove. Class() - Removes one or more classes from the selected elements • toggle. Class() - Toggles between adding/removing classes from the selected elements • css() - Sets or returns the style attribute css({"propertyname": "value", . . . }); CSSmanipulation. html

    Syntax : : : Ajax Method Description $. ajax() Performs an AJAX request ajax. Syntax : : : Ajax Method Description $. ajax() Performs an AJAX request ajax. Complete() Specifies a function to run when the AJAX request completes ajax. Error() Specifies a function to run when the AJAX request completes with an error ajax. Send() Specifies a function to run before the AJAX request is sent $. ajax. Setup() Sets the default values for future AJAX requests $. get() Loads data from a server using an AJAX HTTP GET request load() Loads data from a server and puts the returned HTML into the selected element $. param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests) $. post() Loads data from a server using an AJAX HTTP POST request serialize() Encodes a set of form elements as a string for submission serialize. Array() Encodes a set of form elements as an array of names and values http: //w 3 schools. com/jquery/tryit. asp? filename=tryjquery_ajax 1

    Plugins http: //kevinbatdorf. github. com/codaslider/ Plugins http: //kevinbatdorf. github. com/codaslider/

    Summary j. Query is a fast and concise Java. Script Library that simplifies HTML Summary j. Query is a fast and concise Java. Script Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. j. Query is designed to change the way that you write Java. Script.

    Questions ? Questions ?

    Further interesting j. Query resources • j. Query tutorial http: //w 3 schools. com/jquery/default. Further interesting j. Query resources • j. Query tutorial http: //w 3 schools. com/jquery/default. asp • j. Query basics in less than 2 minutes http: //ejohn. org/apps/learn-jquery/ • Performance proven tricks and tips http: //www. slideshare. net/Addy. Osmani/jquery-proven-performance-tips-tricks • Best sites with j. Query www. bestjquery. com • j. Query tutorials and other stuff http: //docs. jquery. com/Tutorials

    Java. Script frameworks links j. Query http: //jquery. com/ http: //api. jquery. com/ Ext. Java. Script frameworks links j. Query http: //jquery. com/ http: //api. jquery. com/ Ext. JS http: //habrahabr. ru/blogs/extjs/ http: //www. sencha. com/products/extjs/ YUI http: //developer. yahoo. com/yui/ http: //yuilibrary. com/ Java. Script. MVC http: //javascriptmvc. com/ Spine. JS http: //spinejs. com/ Blackbone http: //backbonetutorials. com/ http: //documentcloud. github. com/backbone/

    Thank you for your attention! Thank you for your attention!