Navbar element hide
Hey guys,
How could i hide one element of my nav bar depending on a localStorage property?
Any suggestions?
Thank you very much.
Cheers yves
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hey guys,
How could i hide one element of my nav bar depending on a localStorage property?
Any suggestions?
Thank you very much.
Cheers yves
Hello Yves!
You can do it with JavaScript. On Change value Event Run Javascript with your code like the following:
codevar value = localStorage.getItem('value');
if (value == "0") {
Appery('mobilenavbaritem').hide();
} else {'mobilenavbaritem').show();
}/code
where value - localStorage variable
Thank you Alena, will check it out.
Hey Alena,
Didnt quite get how i can do this. In my application its like that.
user types credentials
service tries login request
on success, service maps to localStorage variables and navigates to page "events"
on "events" i would like to hide the "adminNav" buttons (3 of them are on different pages, all with same name so far)
in the on load event of the "events" page it doesnt work somehow.
cheers and thanks
You can add a simple JS code on page load event to check that this code is working
code
Appery('adminNav').hide();
/code
if it's working then check what value is return to localstorage variable
code
var value = localStorage.getItem('value'); //change the variable name
alert(value);
/code
If you want to use this code on different pages, you should create a JS file with function and call this fuction on Page event.
hey there,
It works now. Thank you very much.
cheers, Yves