admin管理员组

文章数量:1317915

I'm making a web app that shows information about a type of truck - if the user wants to view their content in metric or imperial they click the respective box in the header - I want to change the content of the page to reflect the right system - ideally by not using two different subdomains or pages - thanking you

I'm making a web app that shows information about a type of truck - if the user wants to view their content in metric or imperial they click the respective box in the header - I want to change the content of the page to reflect the right system - ideally by not using two different subdomains or pages - thanking you

Share Improve this question asked Oct 31, 2020 at 15:34 Caolán MaguireCaolán Maguire 11 bronze badge 2
  • Would you just change a table of statistics, or is it paragraphs of text and images too that change? – Rup Commented Nov 1, 2020 at 9:46
  • It would be different images and text - what I ended up doing was setting the classname of whatever element to something fixed example "UserRoleOneOnly" and then using javascript Header And Footer Script plugin to have javascript run a check at the end if there are any elements with that classname and to remove them. – Caolán Maguire Commented Nov 28, 2020 at 12:13
Add a comment  | 

1 Answer 1

Reset to default 0

Well, if you don't want to use two pages, then you have two options - load content via AJAX, or use javascript to hide some of the content (for example imperial units related content).

Second option is much more easier in my opinion, but it may slow down your page, so it's not recommended when there is a lot of content.

本文标签: pluginsDisplaying different content depending on variable