here is the code, I have a menu global variable inside the function. I want to use it outside it, but then I get an "undefined reference error...· This is the only javascript code I have, so there's no interference with another variables or functions.
Thanks in advance.
$(function() {
menu = $('nav#menu').mmenu(
{
navbars: [
{
position: "top",
height : 1,
content : [
'<a href="#/" class="fa fa-phone"></a>',
'<img src="imagenes/wheel32.png" /><p class="navbartxt">bicimap.uy</p>',
]
},
{
position: "bottom",
content: [
'<a class="fa fa-envelope"></a>',
'<a class="fa fa-twitter"></a>',
'<a class="fa fa-facebook"></a>'
]
}
],
extensions: ["multiline"],
onClick: {
close: false
},
navbar:{
title: "Inicio"
},
offCanvas: {
zposition : "next"
}
});
});
I need to put this inside the function to get it working
var API = $("#menu").data( "mmenu" );
menu.on( 'click', 'a[class^="fa fa-twitter"]', function() {
$('#twitter').show();
var API = $("#menu").data( "mmenu" );
API.close();
return false;
});