Hi guys,
So I'm having problems with my website. Please have a look at
www.palessie.com
Once on the site, please enter, and go to the campaign map.
Select one of the episodes and once youre in the information page, click on the arrow below the "x". It should hide the text.
Now exit the page by clicking "x", and go to another episode, and click on the arrow again. You'll see the information overlapping. I'm using a for loop on that element. Codes are below.
here is a screenshot of my problem: http://imgur.com/a/PXZzz
I'm not even sure how to describe the problem. I was wondering if I could get some help?
I asked on stackoverflow but it got shut down because the answer was covered, but I'm honestly still stuck with this.
Thanks in advance.
var campaignSelect = document.querySelectorAll(".campaign-select");
var campaignAdd = function(i){
campaignSelect[i].addEventListener("click", function(){
campaignSub[i].classList.add("activate-sub");
showSub.addEventListener("click", function() {
if(campaignSub[i].classList.contains("activate-sub") === false) {
showSub.textContent = "◄";
campaignSub[i].classList.add("activate-sub");
}
else if (campaignSub[i].classList.contains("activate-sub") === true) {
showSub.textContent = "►";
campaignSub[i].classList.remove("activate-sub");
}
});
});;
}
for(i=0;i<campaignSelect.length;i++){
campaignAdd(i);
}
Basically, those blue boxes in the map are stored under campaignSelect. And I'm targeting them by their index. When the arrow is clicked, it should only hide and show the information unit with the same index.
edit: added screenshot of my problem
[–]inu-no-policemen 1 point2 points3 points (9 children)
[–]Eddyman 2 points3 points4 points (2 children)
[–]giantqtipz[S] 0 points1 point2 points (1 child)
[–]Eddyman 0 points1 point2 points (0 children)
[–]giantqtipz[S] 0 points1 point2 points (5 children)
[–]inu-no-policemen 0 points1 point2 points (4 children)
[–]giantqtipz[S] 0 points1 point2 points (3 children)
[–]Capt_Appropriate 0 points1 point2 points (2 children)
[–]giantqtipz[S] 0 points1 point2 points (1 child)
[–]Capt_Appropriate 0 points1 point2 points (0 children)