Set a section to be collapsed when a page loads
Post here questions and problems related to editing and publishing DITA content.
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: Set a section to be collapsed when a page loads
Hello,
There is no out of the box option to collapse certain elements in the WebHelp output when the page is loaded.
However, this can be achieved by contributing a custom JavaScript code to the WebHelp transformation.
If you are using oXygen and WebHelp plugin 18.1 the following procedure will help you include a custom resource in the output:
https://www.oxygenxml.com/doc/versions/ ... -html.html
The WebHelp Responsive 18.1 output has expand/collapse capabilities for the following type of elements:
NOTE: The above code is available only for oXygen & WebHelp Plugin 18.1 and may not be compatible with future releases.
If you have further questions, please let me know.
Regards,
Alin
There is no out of the box option to collapse certain elements in the WebHelp output when the page is loaded.
However, this can be achieved by contributing a custom JavaScript code to the WebHelp transformation.
If you are using oXygen and WebHelp plugin 18.1 the following procedure will help you include a custom resource in the output:
https://www.oxygenxml.com/doc/versions/ ... -html.html
The WebHelp Responsive 18.1 output has expand/collapse capabilities for the following type of elements:
- Tables with titles
- Nested topics
- Sections with titles
- Indexterms groups
Code: Select all
<div><script>
<!--
var collapsibleSections = {
/* Selectors for the nodes that contain an expand/collapse button. */
"expand_buttons" : [
/* Table caption */
"table > caption > .wh_expand_btn",
/* Article title */
".topic > .title > .wh_expand_btn",
/* Section title */
".sectiontitle > .wh_expand_btn",
/* Index terms groups */
".wh_term_group > .wh_first_letter > .wh_expand_btn"
]
};
$(document).ready(function () {
/* Collapse selected nodes. */
collapsibleSections.expand_buttons.forEach(
function(selector) {
var matchedNodes = $(document).find(selector);
// Change the button state
matchedNodes.toggleClass("expanded");
// Will collapse the siblings of the parent node, excepting the ones that were marked otherwise
var siblings = matchedNodes.parent().siblings(':not(.wh_not_expandable)');
siblings.toggle();
}
);
});
//-->
</script>
</div>
If you have further questions, please let me know.
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 2
- Joined: Wed Aug 12, 2015 1:27 am
Re: Set a section to be collapsed when a page loads
Post by writeDirection »
Hi there,
I'm looking for the same solution for 1.19 - will this work ?
Thanks
I'm looking for the same solution for 1.19 - will this work ?
Thanks
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: Set a section to be collapsed when a page loads
Hello,
I have tested the solution posted above with WebHelp 19.0 and one of our sample DITA maps and it seems to work.
Please let me know if you need further assistance.
Regards,
Alin
I have tested the solution posted above with WebHelp 19.0 and one of our sample DITA maps and it seems to work.
Please let me know if you need further assistance.
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: Set a section to be collapsed when a page loads
Post by shudson310 »
How can we add this expand/collapse functionality to certain elements?
For example, I would like to be able to collapse fig this way.
For example, I would like to be able to collapse fig this way.
alin wrote:Hello,
There is no out of the box option to collapse certain elements in the WebHelp output when the page is loaded.
However, this can be achieved by contributing a custom JavaScript code to the WebHelp transformation.
If you are using oXygen and WebHelp plugin 18.1 the following procedure will help you include a custom resource in the output:
https://www.oxygenxml.com/doc/versions/ ... -html.html
The WebHelp Responsive 18.1 output has expand/collapse capabilities for the following type of elements:Initially, these elements are expanded. In order to toggle their expand state, you can use the following XHTML & JavaScript fragment in combination with the "webhelp.fragment.after.body" parameter (as described in the linked procedure above):
- Tables with titles
- Nested topics
- Sections with titles
- Indexterms groups
NOTE: The above code is available only for oXygen & WebHelp Plugin 18.1 and may not be compatible with future releases.Code: Select all
<div><script>
<!--
var collapsibleSections = {
/* Selectors for the nodes that contain an expand/collapse button. */
"expand_buttons" : [
/* Table caption */
"table > caption > .wh_expand_btn",
/* Article title */
".topic > .title > .wh_expand_btn",
/* Section title */
".sectiontitle > .wh_expand_btn",
/* Index terms groups */
".wh_term_group > .wh_first_letter > .wh_expand_btn"
]
};
$(document).ready(function () {
/* Collapse selected nodes. */
collapsibleSections.expand_buttons.forEach(
function(selector) {
var matchedNodes = $(document).find(selector);
// Change the button state
matchedNodes.toggleClass("expanded");
// Will collapse the siblings of the parent node, excepting the ones that were marked otherwise
var siblings = matchedNodes.parent().siblings(':not(.wh_not_expandable)');
siblings.toggle();
}
);
});
//-->
</script>
</div>
If you have further questions, please let me know.
Regards,
Alin
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: Set a section to be collapsed when a page loads
Post by shudson310 »
I found it! I added
[Codebox=]/* Figure caption */
"figure > p.figcap",[/Codebox]
to com.oxygenxml.webhelp.responsive/templates/dita/bootstrap/resources/js/wt_expand.js
Is there an easier way to add this customization so I don't have to modify the base plugin?
Thanks,
--Scott
[Codebox=]/* Figure caption */
"figure > p.figcap",[/Codebox]
to com.oxygenxml.webhelp.responsive/templates/dita/bootstrap/resources/js/wt_expand.js
Is there an easier way to add this customization so I don't have to modify the base plugin?
Thanks,
--Scott
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: Set a section to be collapsed when a page loads
Post by shudson310 »
Code: Select all
/* Figure caption */
"figure > p.figcap",
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 5
- Joined: Wed Jun 08, 2016 11:47 am
Re: Set a section to be collapsed when a page loads
Post by schelmenzunft »
I have sectioins in individual topics, f.e. topics that contain large graphics, and tehese should open collapsed.
Is it possible to change the status on a topic base?
Thx.
Is it possible to change the status on a topic base?
Thx.
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: Set a section to be collapsed when a page loads
Hi,
Unfortunately, it is not possible to set the collapsible state only for specific topics.
There is the "webhelp.topic.collapsible.elements.initial.state" transfomration parameter indeed, but that controls the global collapsible state (for all elements), not only for one / some of them.
However, we already have an improvement request logged in our internal system, so we have just increased the priority and will notify this thread when something will be implemented on this direction.
Regards,
Costin
Unfortunately, it is not possible to set the collapsible state only for specific topics.
There is the "webhelp.topic.collapsible.elements.initial.state" transfomration parameter indeed, but that controls the global collapsible state (for all elements), not only for one / some of them.
However, we already have an improvement request logged in our internal system, so we have just increased the priority and will notify this thread when something will be implemented on this direction.
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service