Link elements to substep
- Dominant language
- JavaScript
- Stars
- 38.2k
- Forks
- 6.6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
It would be interesting to have a way to link an HTML Element to a specific step so it is shown when a specific step is shown.
I have hacked the code in this way:
```javascript
var showSubstepIfAny = function( step ) {
var substeps = step.querySelectorAll( ".substep" );
var visible = step.querySelectorAll( ".substep-visible" );
if ( substeps.length > 0 ) {
if ( visible.length < substeps.length ) {
var el = substeps[ visible.length ];
el.classList.add( "substep-visible" );
var ssid = el.getAttribute("substepId");
var linkedSS = step.querySelectorAll("[substeplinkedid='"+ssid+"']");
for(var lnkSS of linkedSS) {
lnkSS.classList.add( "linkedVisible" );
}
return el;
}
// return showSubstep( substeps, visible );
}
};
var hideSubstepIfAny = function( step ) {
var substeps = step.querySelectorAll( ".substep" );
var visible = step.querySelectorAll( ".substep-visible" );
var lnkVisibled = step.querySelectorAll( ".linkedVisible" );
if ( substeps.length > 0 ) {
for (var lnkV of lnkVisibled) {
lnkV.classList.remove( "linkedVisible" );
}
return hideSubstep( visible );
}
};
```
and added this class to the CSS:
```css
#impress .step .substepLinked {
opacity: 0;
}
#impress .step .substepLinked.linkedVisible {
opacity: 1;
transition: opacity 2s;
}
```
So now, I can have this type of step config:
```html
Principales características:
- Acceso directo a las Causas
- Agenda compartida de la Unidad Fiscal.
- Alertas.
- Indicadores y Estadísticas.
```
In this way, the `
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the existing substep handling and compare it with the supplied showSubstepIfAny and hideSubstepIfAny functions. Implement the requested relationship between substepId and substepLinkedId, including the supplied visibility styling, then verify that linked elements appear and disappear with their corresponding substeps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100