-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# jQueryのPlugin Pattern | ||
# jQueryのPlugin | ||
|
||
!CODEFILE "../../src/jQuery/jquery.js" | ||
jQueryでは`$.fn`を拡張する事で、`$()`の返り値であるjQueryオブジェクトにメソッドを追加することが出来ます。 | ||
|
||
```js | ||
var jQuery = require("jquery"); | ||
jQuery(document.body); | ||
``` | ||
次の`greenify`プラグインでは、`$(document.body).greenify();`というメソッド呼び出しが可能になります。 | ||
|
||
!CODEFILE "../../src/jQuery/greenify.js" | ||
|
||
実際に利用するためには、`jquery.js`を読み込んだ後に`greenify.js`を読み込ませる必要があります。 | ||
|
||
```html | ||
<script src="jquery.js"></script> | ||
<script src="greenify.js"></script> | ||
``` | ||
|
||
## どういう仕組み?fea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters