alert(positionData[width]);
This is a key warning in positionData and using the width variable as the key. You did not define a variable called width , so it essentially looks for positionData[undefined] . You want positionData.width or positionData['width'] , but there is no reason for quotes.
Quotations are only required if you have a key with non-alphanumeric characters. positionData['some-key'] works, but positionData.some-key is a syntax error because variables cannot have - in them.
Also, your code MUST be an error because the width is nowhere defined. I am worried that you have a globally defined variable width somewhere in your code.
source share