I have the following code which runs inside a local function:
var instance = 'vertical' + view;
//make this variable global
window.instance = instance;
instance = new IScroll( '.' + $(contentAdded).find('.vertical').attr('class'), {
...
And this function gets run a few times througout the application, so I can have multiple instances of the IScroll plugin. However I need these 'instances' to be globally accessible, but because they are dynamic... How do I set them? As the code above just creates a global variable called instance rather than create one that is the name of the dynamic variable.
Trying this:
window.'vertical' + view = 'vertical' + view;
Doesn't work because it doesn't like the string... and doing:
var name = 'vertical' + view;
window.name = instance;
Is the same issue and just creates a variable named name...
How can I do this?