I tried to do this before with slideshows, but I’ve done redesigns and I am using tabs now on a separate page. This is what I have currently:
masterPage.js
// // The code in this file will load on every page of your site
import { local } from 'wix-storage';
import wixLocationFrontend from 'wix-location-frontend';
$w.onReady(function() {
let menuItems = $w('#horizontalMenu2').menuItems; console.log('Menu: ', menuItems);
$w('#horizontalMenu2').onItemClick((event)=> {console.log('Clicked-ID: ', event.target.id);
let label = event.item.label; console.log('Label: ', label);
if(label === 'Organization Committee') {console.log('You clicked Organization Committee');
let tabValue = "Organization";
local.setItem("tab", tabValue);
wixLocationFrontend.to("/main-street-approach#section22");
}
else if(label === 'Design Committee') {console.log('You clicked Design Committee');
let tabValue = "Design";
local.setItem("tab", tabValue);
wixLocationFrontend.to("/main-street-approach#section22");
}
else if(label === 'Promotions Committee') {console.log('You clicked Promotions Committee');
let tabValue = "Promotions";
local.setItem("tab", tabValue);
wixLocationFrontend.to("/main-street-approach#section22");
}
else if(label === 'Economic Vitality Committee') {console.log('You clicked Economic Vitality Committee');
let tabValue = "Economic Vitality";
local.setItem("tab", tabValue);
wixLocationFrontend.to("/main-street-approach#section22");
}
});
});
Main Street Approach
import { local} from 'wix-storage';
$w.onReady(function () {
if (local.getItem('tab')) {
let myTabs = $w("#tabs1").tabs; console.log('list of tabs: ', myTabs);
let numberOfTabs = myTabs.length; console.log('mumber of tabs: ', numberOfTabs); // 3
let myNewTab = local.getItem('tab'); console.log ('my new tab: ', myNewTab);
$w("#tabs1").changeTab(myNewTab);
}
});
For some reason, “myNewTab” keeps coming out as “0” regardless of what I approach I take. It’s as if the data isn’t being sent between pages. Is there something I am doing wrong?
I’ve created posts in the past related to this kind of content, but this is updated as I’ve changed my layout and process of things.