/** * Name of the Plugin (Version 1.0.0) * * Description of jQuery Plugin * * Notes: * * To-do: * * 1.0.0 - Initial Release * * @author Author Name * @copyright Copyright (c) 2011 Company Name * @link https://yoursite.com */ (function($){ $.fn.nameOfPlugin = function(opt) { /* ------------------------------------------------------ * Setup Defaut Options * ------------------------------------------------------ */ var options = $.extend(true, { }, opt); return this.each(function() { /* ------------------------------------------------------ * Define Global Variables * ------------------------------------------------------ */ /* ------------------------------------------------------ * Define main context object * ------------------------------------------------------ */ var context = { options : options, target : $(this) }; /* ------------------------------------------------------ * Initialize * ------------------------------------------------------ */ if(initialize(context)) { // Initialization was successful } else { // Initialization failed buildInitializeErrorMessage(context); } }); }; function initialize(context) { try { return true; } catch(e) { alert(e); } }; // end initialize() function isIpad() { return navigator.userAgent.match(/iPad/i) != null; }; // end isIpad() function buildInitializeErrorMessage(context) { var errorMessage = "Sorry.
We were not able to initialize the plugin."; context.target.append($(document.createElement("div")).addClass("support-message").addClass("error").append( '' + errorMessage + '
' )); }; // end buildInitializeErrorMessage() })(jQuery);