jQueryは使用します

jQuery ライブラリは、単純なマークアップ行で Web ページに追加できます。


jQuery を Web ページに追加する方法はたくさんあります。 次の方法を使用できます:

  • jquery.com から jQuery ライブラリをダウンロードします

  • Google から jQuery をロードするなど、CDN から jQuery をロードします


jQuery をダウンロードします

jQuery には 2 つのバージョンがありますダウンロード可能です:

  • 製品版 - 実際の Web サイトで使用するために、合理化され、圧縮されています。

  • 開発バージョン - テストおよび開発用 (非圧縮、読み取り可能なコード)

上記の両方のバージョンは、jquery.com からダウンロードできます。


jQuery を使用する簡単な方法

jQuery をダウンロードして保存したくない場合は、CDN (Content Delivery Network) 経由で参照することもできます。 Baidu、Youpaiyun、Sina、Google、または Microsoft から jQuery を引用して、<head></script></head>にそれらを入れるだけです。

以下は各大网站のCDN

Baidu CDN:

<head>
<script src="http://libs.baidu.com/jquery/1.10.2 /jquery.min.js">
</script>
</head>


また拍云 CDN:

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


新浪 CDN:

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


Google CDN:

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
< ;/head>

ヒント: Google 製品は中国では非常に不安定であるため、バージョンの取得に Google CDN を使用することはお勧めできません。
Google URL の内容を確認すると、URL には jQuery バージョン (1.8.0) が指定されています。最新バージョンの jQuery を使用したい場合は、バージョン文字列の末尾から数字を削除することもできます (この例では 1.8 など)。Google は 1.8 シリーズの利用可能な最新バージョン (1.8.0、1.8) を返します。 .1 など)、または最初の番号だけを残すことも可能で、Google は 1 シリーズで利用可能な最新バージョン(1.1.0 から 1.9.9)を返します。


:このサイトのすべての例は、Baidu jQuery CDN ライブラリを使用しています。



学び続ける
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js" type="text/javascript"> </script> <script> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </head> <body> <p>如果你点我,我就会消失。</p> <p>继续点我!</p> <p>接着点我!</p> </body> </html>
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!