Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide element for anonymous

Xavier H
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2018

Hi,

I'm running version 6.7.2 and I'm trying to hide element  for anonymous but i'have problems with side bar and help button

( side bar width change during navigation )

 

here javascript used

<script type="text/javascript">

AJS.bind('init.rte', function() {
AJS.$('#notifyWatchers').attr('checked', false);
});

// désactive le workspace en public
AJS.toInit(function(){
if (AJS.params.remoteUser == ''){
AJS.$('#space-menu-link').hide();
AJS.$("#space-tools-menu-trigger").hide();
AJS.$("#more-menu").hide();
AJS.$('#action-menu-link').hide();
AJS.$('#comments-section').hide();
AJS.$('.help-menu-link-content').hide();
AJS.$('.ia-fixed-sidebar').hide();
AJS.$(".aui-iconfont-help").hide();
AJS.Confluence.Sidebar.toggle();

}
});
</script>

Thanks for your help

2 answers

0 votes
Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2018

Or you can simulate the toggle event by this 

AJS.$(".aui-sidebar-toggle").click()
0 votes
Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2018

@Xavier H the AJS.Confluence.Sidebar.toggle(); does not exist

What you can do is to use jQuery to hide those 2 elements

// Hide the left navigation bar and put the right panel to the right position
AJS.$("#nav-sidebar").css("display", "none")
AJS.$(".aui-page-panel").css("padding-left", "55px")

// Hide the top right help button
AJS.$("#help-menu-link").css("display", "none")
Xavier H
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 6, 2018

Thanks for your help and answer. works fine

AJS.Confluence.Sidebar.toggle(); works also

Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2018

What version of Confluence are you using?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events