I have a nested function that I want to call from outside.
var _Config = "";
var tourvar;
function runtour() {
if (_Config.length != 0) {
tourvar = $(function () {
var config = _Config,
autoplay = false,
showtime,
step = 0,
total_steps = config.length;
showControls();
$('#activatetour').live('click', startTour);
function startTour() {
}
function showTooltip() {
}
});
}
}
function proceed() {
tourvar.showTooltip();
}
$(document).ready(function () {
runtour();
});
I was hoping to call it by tourvar.showTooltip(); but I seem to be wrong :) How can I make showTooltip() available from outside the function?
$for? is it because you make use of jQuery or some other library? in that case, which library is it?tourvar.showTooltip = function(){ ... }(although you're going to have to work with native JS objects, not jQuery wrapped ones).$(function(){})is shorthand for$(document).ready(function(){});. So, when you dotourvar = $(function(){, you are settingtourvarto$(document).