I have this html:
<div id="h101" data-stellar-ratio="6"><img src="images/h1_01.png" width="600"></div>
<div id="cloud01" data-stellar-ratio="0.5"><img src="images/cloud_01-s.png"></div>
<div id="cloud02" data-stellar-ratio="0.4"><img src="images/cloud_01-s.png"></div>
<div id="island01" data-stellar-ratio="2"><img src="images/island_01.png" width="620"></div>
I create an array from all the id's
$(".section > div").each(function() {
ellementArray.push($(this).attr("id"));});
Now I have all the values in my ellementArray. What I want to do is to create this:
var h101Left = $("#h101").position().left;
var cloud01Left = $("#cloud01").position().left;
var island02Left = $("#island02").position().left;
var island03Left = $("#island03").position().left;
I was thinking something like this...
for (var i = 0; i < ellementArray.length; i++){
jQuery.globalEval("var ellementArray[i] = ellementArray[i];")
console.log(ellementArray[i]);
}
Can somebody please help?