You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: page/plugins/advanced-plugin-concepts.md
-47Lines changed: 0 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -138,53 +138,6 @@ So how then do we define more functions without cluttering the namespace and wit
138
138
139
139
Our "debug" method cannot be accessed from outside of the closure and thus is private to our implementation.
140
140
141
-
### Support the Metadata Plugin
142
-
143
-
Depending on the type of plugin you're writing, adding support for the [Metadata Plugin](http://docs.jquery.com/Plugins/Metadata/metadata) can make it even more powerful. Personally, I love the Metadata Plugin because it lets you use unobtrusive markup to override plugin options (which is particularly useful when creating demos and examples). And supporting it is very simple!
144
-
145
-
```
146
-
// Plugin definition.
147
-
$.fn.hilight = function( options ) {
148
-
149
-
// Build main options before element iteration.
150
-
var opts = $.extend( {}, $.fn.hilight.defaults, options );
151
-
152
-
return this.each(function() {
153
-
var $this = $( this );
154
-
155
-
// Build element specific options.
156
-
// This changed line tests to see if the Metadata Plugin is installed,
157
-
// And if it is, it extends our options object with the extracted metadata.
158
-
var o = $.meta ? $.extend( {}, opts, $this.data() ) : opts;
159
-
160
-
//...
161
-
162
-
});
163
-
164
-
};
165
-
```
166
-
167
-
*Note:* This line is added as the last argument to *jQuery.extend* so it will override any other option settings. Now we can drive behavior from the markup if we choose:
And now we can hilight each of these `<div>`s uniquely using a single line of script:
183
-
184
-
```
185
-
$( ".hilight" ).hilight();
186
-
```
187
-
188
141
###Bob and Sue
189
142
190
143
Let's say Bob has created a wicked new gallery plugin (called "superGallery") which takes a list of images and makes them navigable. Bob's thrown in some animation to make it more interesting. He's tried to make the plugin as customizable as possible, and has ended up with something like this:
0 commit comments