substep: add substep-active class (#741)
This commit is contained in:
committed by
Henrik Ingo
parent
2826aecde7
commit
934c2266c4
@@ -3746,6 +3746,7 @@
|
|||||||
var steps = startingState[ root.id ];
|
var steps = startingState[ root.id ];
|
||||||
var step;
|
var step;
|
||||||
while ( step = steps.pop() ) {
|
while ( step = steps.pop() ) {
|
||||||
|
|
||||||
// Reset x/y/z in cases where this plugin has changed it.
|
// Reset x/y/z in cases where this plugin has changed it.
|
||||||
if ( step.relX !== null ) {
|
if ( step.relX !== null ) {
|
||||||
if ( step.x === null ) {
|
if ( step.x === null ) {
|
||||||
@@ -4002,8 +4003,12 @@
|
|||||||
|
|
||||||
var showSubstep = function( substeps, visible ) {
|
var showSubstep = function( substeps, visible ) {
|
||||||
if ( visible.length < substeps.length ) {
|
if ( visible.length < substeps.length ) {
|
||||||
|
for ( var i = 0; i < substeps.length; i++ ) {
|
||||||
|
substeps[ i ].classList.remove( "substep-active" );
|
||||||
|
}
|
||||||
var el = substeps[ visible.length ];
|
var el = substeps[ visible.length ];
|
||||||
el.classList.add( "substep-visible" );
|
el.classList.add( "substep-visible" );
|
||||||
|
el.classList.add( "substep-active" );
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -4018,6 +4023,16 @@
|
|||||||
|
|
||||||
var hideSubstep = function( visible ) {
|
var hideSubstep = function( visible ) {
|
||||||
if ( visible.length > 0 ) {
|
if ( visible.length > 0 ) {
|
||||||
|
var current = -1;
|
||||||
|
for ( var i = 0; i < visible.length; i++ ) {
|
||||||
|
if ( visible[ i ].classList.contains( "substep-active" ) ) {
|
||||||
|
current = i;
|
||||||
|
}
|
||||||
|
visible[ i ].classList.remove( "substep-active" );
|
||||||
|
}
|
||||||
|
if ( current > 0 ) {
|
||||||
|
visible[ current - 1 ].classList.add( "substep-active" );
|
||||||
|
}
|
||||||
var el = visible[ visible.length - 1 ];
|
var el = visible[ visible.length - 1 ];
|
||||||
el.classList.remove( "substep-visible" );
|
el.classList.remove( "substep-visible" );
|
||||||
return el;
|
return el;
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ Example:
|
|||||||
<p class="substep">Apple</p>
|
<p class="substep">Apple</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Classes:
|
||||||
|
|
||||||
|
`substep-active` - The most recent substep in the current step
|
||||||
|
|
||||||
|
`substep-visible` - The most recent and all previous substeps in the current step
|
||||||
|
|
||||||
Author
|
Author
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,12 @@
|
|||||||
|
|
||||||
var showSubstep = function( substeps, visible ) {
|
var showSubstep = function( substeps, visible ) {
|
||||||
if ( visible.length < substeps.length ) {
|
if ( visible.length < substeps.length ) {
|
||||||
|
for ( var i = 0; i < substeps.length; i++ ) {
|
||||||
|
substeps[ i ].classList.remove( "substep-active" );
|
||||||
|
}
|
||||||
var el = substeps[ visible.length ];
|
var el = substeps[ visible.length ];
|
||||||
el.classList.add( "substep-visible" );
|
el.classList.add( "substep-visible" );
|
||||||
|
el.classList.add( "substep-active" );
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -85,6 +89,16 @@
|
|||||||
|
|
||||||
var hideSubstep = function( visible ) {
|
var hideSubstep = function( visible ) {
|
||||||
if ( visible.length > 0 ) {
|
if ( visible.length > 0 ) {
|
||||||
|
var current = -1;
|
||||||
|
for ( var i = 0; i < visible.length; i++ ) {
|
||||||
|
if ( visible[ i ].classList.contains( "substep-active" ) ) {
|
||||||
|
current = i;
|
||||||
|
}
|
||||||
|
visible[ i ].classList.remove( "substep-active" );
|
||||||
|
}
|
||||||
|
if ( current > 0 ) {
|
||||||
|
visible[ current - 1 ].classList.add( "substep-active" );
|
||||||
|
}
|
||||||
var el = visible[ visible.length - 1 ];
|
var el = visible[ visible.length - 1 ];
|
||||||
el.classList.remove( "substep-visible" );
|
el.classList.remove( "substep-visible" );
|
||||||
return el;
|
return el;
|
||||||
|
|||||||
Reference in New Issue
Block a user