Skip to content

Commit 7337bea

Browse files
committed
Removed extra example plugin to shorten article.
1 parent c2a064b commit 7337bea

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

content/plugins/basic-plugin-creation.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ In addition, the primary purpose of an Immediately Invoked Function is to allow
7575

7676
Your typical jQuery object will contain references to any number of DOM
7777
elements, and that's why jQuery objects are often referred to as collections.
78-
If you want to do any manipulating with specific elements (eg: getting an
79-
attribute, individualy calculated positions) then you need to use `each()` to
78+
If you want to do any manipulating with specific elements (eg: getting data an
79+
attribute, calculating specific positions) then you need to use `each()` to
8080
loop through the elements.
8181

8282
<javascript>
@@ -89,7 +89,7 @@ $.fn.myNewPlugin = function() {
8989

9090
Notice that we return the results of `each()` instead of returning `this`.
9191
Since `each()` is already chainable, it returns `this`, which we then return.
92-
This is a better way to write plugins than what we've been doing so far.
92+
This is a better way to maintain chainability than what we've been doing so far.
9393

9494
##Putting it together
9595

@@ -137,20 +137,3 @@ return value of that callback will determine what is appended to each element
137137
in the collection. Notice also that we're not using the `attr` method to
138138
retrieve the href attribute, because the native DOM API gives us easy access
139139
with the aptly named href property.
140-
141-
Here's another example of a plugin. This one doesn't require us to loop
142-
through every element with the `each()` method. Instead, we're simply going to
143-
delegate to other jQuery methods directly:
144-
145-
<javascript>
146-
(function($){
147-
$.fn.fadeInAndAddClass = function(duration, className) {
148-
return this.fadeIn(duration, function(){
149-
$(this).addClass(className);
150-
});
151-
};
152-
}(jQuery));
153-
154-
// Usage example:
155-
$('a').fadeInAndAddClass(400, 'finishedFading');
156-
</javascript>

0 commit comments

Comments
 (0)