jQuery介紹

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   io   os   使用   java   

 

官方定義:

write less ,do more :Lightweight Footprint、CSS3 Compliant、Cross-Browser

What is jQuery?

  • jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

 

Wiki:

define:

  • jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.
  • jQuery is free, open source software, licensed under the MIT License.
  • jQuery‘s syntax is designed to make it easier to navigate a document, select DOM elements, createanimations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plug-ins on top of the JavaScript library. This enables developers to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. The modular approach to the jQuery library allows the creation of powerful dynamic web pages and web applications.

overviw:

  • jQuery, at its core, is a DOM manipulation library. The DOM is a tree structure representation of all the elements of a web-page and jQuery makes finding, selecting, and manipulating these DOM elements very simple and convenient. For example, jQuery can be used for finding an element in the document with a certain property (e.g. all elements with an h1 tag), changing one or more of its attributes (e.g. color, visibility), or making it respond to an event (e.g. a mouse click).
  • However, beyond basic DOM selecting and manipulation, jQuery provides a new paradigm of writing event handling in Javascript. The event assignment and the event callback function are done in a single step in a single location in the code.

The advantages of using jQuery are:

  • Separates Javascript and HTML: Instead of using HTML attributes to call Javascript functions for event handling, jQuery allows all event-handling functions to be done purely in Javascript. Thus, the HTML tags and Javascript can be completely separated.
  • Brevity and Clarity: jQuery provides various syntaxes that promotes brevity and clarity, e.g. chaining effects and actions, shorthand methods.
  • Eliminates cross-browser incompatibilities: The Javascript engines of different browsers differ slightly, so Javascript code that works for one browser may not work on the other. jQuery handles all these cross-browser inconsistencies and provides a consistent interface that works across different browsers.

jQuery includes the following features:

  • DOM element selections using the multi-browser open source selector engine Sizzle, a spin-off of the jQuery project
  • DOM traversal and modification (including support for CSS 1–3)
  • DOM manipulation based on CSS selectors that uses node elements name and node elements attributes (id and class) as criteria to build selectors
  • Events
  • Effects and animations
  • AJAX
  • JSON parsing
  • Extensibility through plug-ins
  • Utilities - such as user agent information, feature detection
  • Compatibility methods that are natively available in modern browsers but need fall backs for older ones - For example the inArray() and each()functions.
  • Multi-browser (not to be confused with cross-browser) support.
  • multitude  browsers support

 

百科定義:

什麼是jQuery?

  • Jquery是繼prototype之後又一個優秀的Javascript架構。它是輕量級的js庫 ,它相容CSS3,還相容各種瀏覽器(IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+),jQuery2.0及後續版本將不再支援IE6/7/8瀏覽器。jQuery使使用者能更方便地處理HTML(標準通用標記語言 (SGML)下的一個應用)、events、實現動畫效果,並且方便地為網站提供AJAX互動。jQuery還有一個比較大的優勢是,它的文檔說明很全,而且各種應用也說得很詳細,同時還有許多成熟的外掛程式可供選擇。jQuery能夠使使用者的html頁面保持代碼和html內容分離,也就是說,不用再在html裡面插入一堆js來調用命令了,只需定義id即可。
  • jQuery是免費、開源的,使用MIT許可協議。jQuery的文法設計可以使開發人員更加便捷,例如操作文檔對象、選擇DOM元素、製作動畫效果、事件處理、使用Ajax以及其他功能。除此以外,jQuery提供API讓開發人員編寫外掛程式。其模組化的使用方式使開發人員可以很輕鬆的開發出功能強大的靜態或動態網頁。

使用方法:

  • jQuery可以下載使用,有兩個版本的 jQuery 可供下載
    •  Production version - 用於實際的網站中,已被精簡和壓縮。
    •  Development version - 用於測試和開發(未壓縮,是可讀的代碼)
    •  也可以從多個公用伺服器中選擇引用。把jQuery儲存在CDN公用庫上可加快網站載入速度,(CDN公用庫是指將常用的JS庫存放在CDN節點,以方便廣大開發人員直接調用)。
  •  1 Google CDN: 2 <scripttype="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> 3 Microsoft CDN: 4 <scripttype="text/javascript"src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script> 5 新浪 CDN: 6 <scripttype="text/javascript"src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script> 7 百度 CDN: 8 <scripttype="text/javascript"src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script> 9 使用本地jQuery:10 <scripttype="text/javascript">window.jQuery||document.write(‘<scriptsrc="//localhost/jQuery/jquery-2.1.0.min.js"><\/script>‘);</script>11 Wordpress主題中使用:12 <scripttype="text/javascript">window.jQuery||document.write(‘<scripttype="text/javascript"src="<?phpechoget_template_directory_uri();?>/jquery.min.js">\x3C/script>‘)</script>

     

W3SCHOOL:(詳細學習請移步於此)

jQuery 是一個 JavaScript 函數庫。jQuery 庫可以通過一行簡單的標記被添加到網頁中。

jQuery 庫包含以下特性:

  • HTML 元素選取
  • HTML 元素操作
  • CSS 操作
  • HTML 事件函數
  • JavaScript 特效和動畫
  • HTML DOM 遍曆和修改
  • AJAX
  • Utilities

 

jQuery介紹

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.