I am trying to create a very basic plugin for my Google Map. The code is working without paasing any options but I got confused how to set up the last part to accept the options as well.Here is my code
(function($) { $.fn.googlemap = function(options) { google.maps.visualRefresh = true; var defaults = { zoom: 16, center: new google.maps.LatLng(49.241943, -122.889318), disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROADMAP }, settings = $.extend({}, defaults, options); var map = new google.maps.Map(document.getElementById("googlemap"), defaults); } }(jQuery));
As I said this is working but I can not pass any parameters through googlemap();
$(document).ready( function() { $('#googlemap').googlemap(); });
Can you please let me know how I can fix this? Thanks