I think i have a basic problem in understanding the dojo toolkit. Well I know in javascript returning a variable and calling it in another function works like this:
function a(){
var x=5;
return x;
}
function b(){
var y=a();
console.log(y);
}
5
Well, now i need the imgsize in function b() and can show you my dojo code. I tried the whole afternoon to call imgsize in my function b() but I didnÄt get it… perhaps u can help me 🙂
require(["dojo/window"], function(win){
// Get the viewport-size of the document:
var viewportsize =win.getBox();
var imgsize = (viewportsize.w)/4;
});
function b(){
var x = ???????
}
You have a scope issue. You defined the variable inside the function, so once the function is executed, imgsize is gone.