<script> // Like Function, There is no selector jQuery.reload = function () { location = location; }; $(document).ready(function () { $.reload(); }); // It has selector, normal plugin jQuery.fn.myPluginMethod = function (options) { $(this).css('color', 'White'); $(this).css('background', 'Black'); }; $(document).ready(function () { $('h1').myPluginMethod(); }); </script>
Hi~! Today we make jquery plugin.
There is two way. That have selector or not.
- Make -
First.
jQuery.pluginName = function () {
};
It doen't have selector.
Second.
jQuery.fn.pluginName = function(options) {
};
It has selector.
- Use -
First.
$.pluginName();
Second
$(selector).pluginName();
We can use this two way.
That's it!
We can make jquery plugin~^^
Let's Coding~~~~~~~~!!
No comments:
Post a Comment