Pass object to plugin options
I can't for the life of me figure out how to do this. I've got two plugins that I'm trying to get to work together. In one I set the cookie and perform various actions (I'll spare everyone the code of the other functions). In the second file I get the users location and perform various functions on their location. My problem is that I need to set the cookie in plugin one but my cookie name will change it's not always going to be
profileColor
is there a way to pass options somehow into the other file so when I call
dataProfile()
it accounts for the various cookie names or is there another way to do it? Been banging my head for hours. Bit of a newb so code samples are best for me.
jQuery
);
Plugin One
window.NNA.dataMgr = window.NNA.dataMgr || (function() {
var profile_cookie = {
name: 'profileColor',
options: {
path: '/',
expires: 365
}
};
return {
load: function() {
if($(".header-slideshow").length > 0){
$.cookie(profile_cookie.name);
}
}
}
Plugin Two
;(function($){
$.fn.dataProfile = function(opts) {
function getLocation(){
if($(".user-loc").length > 0){
var geoLocation = NNA.dataMgr.load();
}
}
}})(jQuery);
$(document).ready(function () { $('#container').dataProfile(); });