Yves Senn
Posts: 0
Joined: Tue May 21, 2013 4:46 am

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Navbar element hide

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

Yves Senn
Posts: 0
Joined: Tue May 21, 2013 4:46 am

Navbar element hide

Thank you Alena, will check it out.

Yves Senn
Posts: 0
Joined: Tue May 21, 2013 4:46 am

Navbar element hide

Hey Alena,

Didnt quite get how i can do this. In my application its like that.

  1. user types credentials

  2. service tries login request

  3. on success, service maps to localStorage variables and navigates to page "events"

  4. 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

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Navbar element hide

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.

Yves Senn
Posts: 0
Joined: Tue May 21, 2013 4:46 am

Navbar element hide

hey there,

It works now. Thank you very much.

cheers, Yves

Return to “Issues”