1 / 16

Jquery

Jquery. Nasrullah. Jquery. jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn. Why JQuery. Many of the biggest companies on the Web use jQuery , such as : Google Microsoft IBM Netflix. Download JQuery.

shilah
Download Presentation

Jquery

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jquery Nasrullah

  2. Jquery • jQuery is a JavaScript Library. • jQuery greatly simplifies JavaScript programming. • jQuery is easy to learn

  3. Why JQuery Many of the biggest companies on the Web use jQuery, such as: • Google • Microsoft • IBM • Netflix

  4. Download JQuery • The jQuery library is a single JavaScript file, and you reference it with the HTML • <head>< script src="jquery-1.9.1.min.js"></script>< /head>

  5. Alternatives to Downlaoding • If you don't want to download and host jQuery yourself, you can include it from a CDN (Content Delivery Network). • Both Google and Microsoft host jQuery. • To use jQuery from Google or Microsoft, use one of the following: • <head><script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">< /script>< /head> • <head>< script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js">< /script>< /head>

  6. What is Jquery • jQuery is a lightweight, "write less, do more", JavaScript library. • The purpose of jQuery is to make it much easier to use JavaScript on your website. • jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. • jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation

  7. J query libray features • HTML/DOM manipulation • CSS manipulation • HTML event methods • Effects and animations • AJAX • Utilities

  8. Locate the User Position • The HTML5 GeolocationtAPI is used to get the geographical position of a user.

  9. Jquery syntax • The jQuery syntax is made for selecting HTML elements and performing some action on the element(s). • Basic syntax is: $(selector).action() • A $ sign to define/access jQuery • A (selector) to "query (or find)" HTML elements • A jQueryaction() to be performed on the element(s)

  10. Using GeoLocation • Use the getCurrentPosition() method to get the user's position • The navigator object contains information about the browser • Navigator.geolocation • Navigator.appname; • Navigator.platform

  11. $(this).hide() - hides the current element. • $("p").hide() - hides all <p> elements. • $(".test").hide() - hides all elements with class="test". • $("#test").hide() - hides the element with id="test".

  12. Document Ready • You might have noticed that all jQuery methods are inside a document ready event • $(document).ready(function(){// jQuery methods go here...}); This is to prevent any jQuery code from running before the document is finished loading (is ready). • It is good practice to wait for the document to be fully loaded and ready before working with it. This also allows you to have your JavaScript code before the body of your document, in the head section. Here are some examples of actions that can fail if methods are run before the document is fully loaded: • Trying to hide an element that is not created yet • Trying to get the size of an image that is not loaded yet

  13. Jquery Syntax for Event Methods • All the different visitor's actions that a web page can respond to are called events • moving a mouse over an element • selecting a radio button • clicking on an element $("p").click(); $("p").click(function(){  // action goes here!!});

  14. Use the getCurrentPosition() method to get the user's position • Navigator.geolocation.getCurrentPosition(

More Related