Created
March 15, 2014 16:06
-
-
Save crazylion/9569646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var PackerMap=function(element,options){ | |
}; | |
PackerMap.prototype.center=function(lat,lng){ | |
} | |
$.fn.packerMap = function(options,prop,prop2) { | |
var args = Array.prototype.slice.call(arguments); | |
return this.each(function() { | |
var $this = $(this); | |
var data = $this.data('packerMap'); | |
if (!data){ | |
$this.data('packerMap', (data = new PackerMap(this, options))); | |
} | |
if(typeof options == 'string'){ | |
var argumentArray = args.slice(1); | |
data[options].apply(data,argumentArray); | |
} | |
}); | |
} | |
$.fn.packerMap.Constructor =PackerMap; | |
$.fn.packerMap.defaults={ | |
mapId:"map" | |
}; | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#map").pacerMap(); //single map | |
$("#map").packerMap("center",121,22); // move map center to lat,lng: 121.22 # call PackerMap.center(121,22) | |
// | |
$(".map").packerMap(); // init multi google maps if there are many objects with css class "map " | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment