Create a "Popup" jQuery Plugin
I am looking for creating my own popup dialog jQuery plugin
(I know this looks stupid, but please, go ahead reading)
. I have read more about creating plugin in jQuery in their documentation and I've already written something but I realized that I don't know my directions. I mean should I have something like:
- <div class="popup" id="myWindow">This is some of its contents</div>
- <script>
- $("#myWindow").popup({/* options */}, { ok: "Ok", cancel: "Cancel" /* buttons */ });
- </script>
or should I go for somethings else? Below is somethings I've written, but I don't have an implementation yet:
- (function( $ ) {
- $.fn.popup = function( options )
- {
- var opts = $.extend({}, $.fn.popup.defaults, options);
- };
- $.fn.popup.defaults = {
- width: "350px",
- backgroundColor: "#ffffff"
- };
- }(jQuery));
I don't really need somebody to write my entire code, but I want some directions and references. Also, if you have the time to help with some snippets (because I am not an advanced jQuery user/programmer), I will be grateful.
So, can anybody help me?