v1.1.0
making JSON objects order unnecessary
- adding
data.forEach
function inelements.forEach
function. data.forEach
is created to loop throughdata
and search on the object that owns the sameSPAname
that is in clicked element.- while it looping it compares every object's
SPAname
value with clicked elementSPAname
meta tag. - if they are the same it'll change
window.title
toSPAtitle
that is in that object. - also will append the
SPAurl
to the window URL usingwindow.history.pushState
.
NOTE: I moved document.title = data[index][SPAtitle];
& window.history.pushState("","",data[index][SPAurl]);
inside if
condition that is in data.forEach
.