1. 程式人生 > >h5、jquery 。個庫CDN

h5、jquery 。個庫CDN

str yun 新浪 加載 包括 頁面 .com ring scrip

<body onload=" ">是在頁面所有元素(包括html標簽以及引用到得所有圖片,Flash等媒體)加載完畢後執行的,

$(document).ready(function(){}) 替換為$(function)

是文檔結構已經加載完成(不包含圖片等非文字媒體文件),不必等到所有的加載完畢.<body onload=" ">和$(function)不能同時使用

CDN:

菜鳥教程 <head> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> </head>

百度<head> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> </head>

又拍雲<head> <script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js"> </script> </head>

新浪<head> <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"> </script> </head>

谷歌<head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> </head>一般不使用,因為谷歌在中國不穩定

Microsoft <head> <script src="http://ajax.htmlnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"> </script> </head>

jquery格式:

  • $(this).hide() - 隱藏當前元素

  • $("p").hide() - 隱藏所有 <p> 元素

  • $("p.test").hide() - 隱藏所有 class="test" 的 <p> 元素

  • $("#test").hide() - 隱藏所有 id="test" 的元素

h5、jquery 。個庫CDN