X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fjquery%2Fjquery.arrowSteps.js;h=629ce32ca7628d71462e532806df66d0934b8b31;hb=3e19b06deec72b3cca5b527e93f7023cfc4c2293;hp=66a3c569e09889e26d0d5bf96b062577a57edc89;hpb=19a38526f390cfdc6a6061cc055fc7f13167bf03;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/jquery/jquery.arrowSteps.js b/resources/src/jquery/jquery.arrowSteps.js index 66a3c569e0..629ce32ca7 100644 --- a/resources/src/jquery/jquery.arrowSteps.js +++ b/resources/src/jquery/jquery.arrowSteps.js @@ -35,11 +35,12 @@ * @chainable */ $.fn.arrowSteps = function () { - var $steps, width, arrowWidth, + var $steps, width, arrowWidth, $stepDiv, + $el = this, paddingSide = $( 'body' ).hasClass( 'rtl' ) ? 'padding-left' : 'padding-right'; - this.addClass( 'arrowSteps' ); - $steps = this.find( 'li' ); + $el.addClass( 'arrowSteps' ); + $steps = $el.find( 'li' ); width = parseInt( 100 / $steps.length, 10 ); $steps.css( 'width', width + '%' ); @@ -47,11 +48,16 @@ // Every step except the last one has an arrow pointing forward: // at the right hand side in LTR languages, and at the left hand side in RTL. // Also add in the padding for the calculated arrow width. - arrowWidth = parseInt( this.outerHeight(), 10 ); - $steps.filter( ':not(:last-child)' ).addClass( 'arrow' ) - .find( 'div' ).css( paddingSide, arrowWidth.toString() + 'px' ); + $stepDiv = $steps.filter( ':not(:last-child)' ).addClass( 'arrow' ).find( 'div' ); + + // Execute when complete page is fully loaded, including all frames, objects and images + $( window ).load( function () { + arrowWidth = parseInt( $el.outerHeight(), 10 ); + $stepDiv.css( paddingSide, arrowWidth.toString() + 'px' ); + } ); + + $el.data( 'arrowSteps', $steps ); - this.data( 'arrowSteps', $steps ); return this; }; @@ -74,7 +80,7 @@ $.each( $steps, function ( i, step ) { var $step = $( step ); if ( $step.is( selector ) ) { - if ($previous) { + if ( $previous ) { $previous.addClass( 'tail' ); } $step.addClass( 'head' );