Skip to main content
Inspiring
March 19, 2024
Answered

Global way to force auto-expand dropdowns in Frameless

  • March 19, 2024
  • 3 replies
  • 323 views

version - RH 2022.3.93

Output preset - Frameless

---

For some reason, a few writers want the dropdowns to auto-expand upon loading the page.

 

I can achieve this for an individual dropdown with the attribute data-expanded="true".

***

Before I loop through all dropdowns in my project, I'd like to ask if I'm not overcomplicating things and if there is a simpler way of doing this?

This topic has been closed for replies.
Correct answer Amebr

If you can find the code that makes that button work in the skin you're using, you should be able to bung it in a script so you don't have to write your own code.

 

For example, I tried this in the master page of a RH2019 Frameless project. You can probably also add it in the User Assets section of the skin as an attached JS file. Note I'm just a hack and can't advise on best practices. 

 

Note: you'll need to check the code for RH2022 as I'm sure it's changed in newer versions.

 

Also test thoroughly as I couldn't say what side effects might result. Probably consult a friendly developer if you have one. 🙂

 

  document.addEventListener("DOMContentLoaded", (event) => {
    rh.model.publish(rh.consts('EVT_EXPAND_COLLAPSE_ALL'));
  });

(The first and third lines make sure the html has all been loaded before the script runs - I think it's necessary but you could try without them if you want. The second line is the button code I found in my skin under Topic Page Buttons > Expand/Collapse All > OnClick)

3 replies

AmebrCommunity ExpertCorrect answer
Community Expert
March 19, 2024

If you can find the code that makes that button work in the skin you're using, you should be able to bung it in a script so you don't have to write your own code.

 

For example, I tried this in the master page of a RH2019 Frameless project. You can probably also add it in the User Assets section of the skin as an attached JS file. Note I'm just a hack and can't advise on best practices. 

 

Note: you'll need to check the code for RH2022 as I'm sure it's changed in newer versions.

 

Also test thoroughly as I couldn't say what side effects might result. Probably consult a friendly developer if you have one. 🙂

 

  document.addEventListener("DOMContentLoaded", (event) => {
    rh.model.publish(rh.consts('EVT_EXPAND_COLLAPSE_ALL'));
  });

(The first and third lines make sure the html has all been loaded before the script runs - I think it's necessary but you could try without them if you want. The second line is the button code I found in my skin under Topic Page Buttons > Expand/Collapse All > OnClick)

Community Expert
March 19, 2024

I'm also assuming you want this in your output, rather than in the RH editor. I think Peter's manual suggestion would be the only option in the editor.

Peter Grainge
Community Expert
Community Expert
March 19, 2024

It's not what you want but the icon below allows your users to expand/contract all.

 

 

In Author mode when editing, click within one dropdown and the context menu has expand/contract all options.

________________________________________________________

My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

 

Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
Jeff_Coatsworth
Community Expert
Community Expert
March 19, 2024

I don't recall any control in the Preset for being able to do this [set them all to auto-expand], so your approach is probably fine.