Hey I am looking to change my a plugin that I created to use the document namespace. I have been researching this but I am lost on how to do it.
Here is the start of the plugin code:
(function ($) {
$.fn.extend({
BGP: function (options) {
Currently the call to the plugin uses:
$(document).BGP({ /*options*/});
I want it to be more like:
$.BGP({ /*options*/});
Any help and explanation would be GREAT!
If you mean you want it to be a jQuery global function and pollute THAT namespace :), you probably want
It’s ok to do that in code (someone will say differently, no doubt, and they probably know better than I do) that you’re only using on your own site, where you know that no one else will use that namespace, but a bad idea if you’re planning to distribute the code (i.e. in a plugin).