Hello,
I have a link on page 2 and an image on page 3. I want to add / remove a class on the image when I click the link. I have it working when they are on the same page. But how do I call the action on all visible pages from the javascript?
current working code (same page)
function init(c,a) {
c.find(".testlink").on("click", function(e) {
var image = a.$(e.target).attr("data-img");
c.find(".img").removeClass("show");
c.find("#"+image).addClass("show");
});
}; init
hi, the first page is initializing first all the time, so i recommend to create a global array for images there and add/remove images from other pages when page init/dispose. In the link click handler manipulate with the global array.
Also you can: