jquery-steps icon indicating copy to clipboard operation
jquery-steps copied to clipboard

The .content area should auto expand.

Open simondoescode opened this issue 12 years ago • 26 comments

The .content area should auto expand and contract to accommodate the content. This would be a very welcome addition.

simondoescode avatar Sep 17 '13 20:09 simondoescode

Hi Simonn-,

Thank you first for your contribution.

I’m not sure if I understand your request correct. Please help me to get the right idea of what you really need. Am I right by thinking of auto height calculation so that the content fits at any time?

Cheers, Rafael

rstaib avatar Sep 17 '13 20:09 rstaib

Hi Rafael, Thank you for getting back to me.

Yes you are right in thinking that auto height calculation should be added so that the content fits at any time. With smooth transitions.

Thanks, Simon

simondoescode avatar Sep 17 '13 20:09 simondoescode

Hi Simonn-,

Okay, good news for you. This is already a planned enhancement for the next version. I will close your feature request when releasing the next version.

Thanks again!

Rafael

rstaib avatar Sep 17 '13 21:09 rstaib

Hi Rafael, Thats good news, when is the next version out?

Simon

simondoescode avatar Sep 17 '13 21:09 simondoescode

Hi Simon,

there is no fixed release date. I will inform you when it's out.

Rafael

rstaib avatar Sep 18 '13 08:09 rstaib

same issue so thanks in advance...

socialatm avatar Sep 29 '13 23:09 socialatm

In jquery.steps.css under .wizard > .content > .body remove position: absolute; and you're all set...

socialatm avatar Sep 30 '13 01:09 socialatm

Hi @twentyfiveautumn,

First, thank you for your contribution.

Yes, you're right as long as you're not using any transition effect that requires absolute positioning. One example for that is the slideLeft effect.

Cheers,

Rafael

rstaib avatar Sep 30 '13 12:09 rstaib

Hi Rafael. I understand what you mean. This just gets it so you can see the entire content. Not a complete fix for sure...

socialatm avatar Oct 03 '13 00:10 socialatm

This worked fine for me (still using position absolute). I've set min-heights for all of my steps (could also be height). Can be improved though.

    $("#wizard").steps({
        headerTag: "h2",
        bodyTag: "section",
        transitionEffect: "slideLeft",
        stepsOrientation: "horizontal",
        onStepChanging: function (event, currentIndex, newIndex) {
            var nextStep = '#wizard #wizard-p-' + newIndex;
            var heightNextStep = $(nextStep).css('minHeight');
            $(nextStep).parent().animate({height:heightNextStep},200);
            return true; 
        }
    });

Example can be seen here: http://woonbewust-zonnepanelen.nl/zonnepanelen-rendement-berekenen

janniconl avatar Jan 05 '14 15:01 janniconl

Hi Rafael, just another request for this functionality as doesn't appear to be working in 1.0.4 released last month either.

bagofjuice avatar Jan 14 '14 22:01 bagofjuice

@bagofjuice here a temp fix (little adjustment of @janniconl's code)

onStepChanged: function (event, currentIndex, priorIndex) {
    var nextStep = '#wizard #wizard-p-' + currentIndex;
    var totalHeight = 0;
    $(nextStep).children().each(function () {
        totalHeight += $(this).outerHeight(true);
    });
    $(nextStep).parent().animate({ height: totalHeight }, 200);
}

lgoudriaan avatar Jan 20 '14 11:01 lgoudriaan

Thanks, I have it working well in my scenario now (I have elements that show/hide within a step so a bit more logic added).

bagofjuice avatar Jan 20 '14 13:01 bagofjuice

Hi I resolved the issue like below:

I add a javascript function: function prepareStepsCss(currentIndex) { var newStep = 'wizard-p-' + currentIndex; $('div.content').removeAttr('id'); $('div.content').attr('id', newStep); }

And call that function from OnStepChanged:

$(wizardDivId).steps({ headerTag: "h5", bodyTag: "section", transitionEffect: "slideLeft", onStepChanging: function (event, currentIndex, newIndex) { return true;

    },
    onStepChanged: function(event, currentIndex) {
        prepareStepsCss(currentIndex);
    },
    onFinishing: function (event, currentIndex) {
      return true;
    },

    onFinished: function (event, currentIndex) {
        return true;
    }

});

function prepareStepsCss(currentIndex) { var newStep = 'wizard-p-' + currentIndex; $('div.content').removeAttr('id'); $('div.content').attr('id', newStep); }

In css: #wizard-p-0 { min-height: 26em; }

#wizard-p-1 { min-height: 30em; }

It works for me.

tunhein avatar Feb 28 '14 11:02 tunhein

As I had asynchronously loaded content I had to modify

function loadAsyncContent(wizard, options, state) 

like (also padding was not dealt with with the suggestions all around - perhaps aboves does take care of that):

$.ajax({ url: currentStep.contentUrl, cache: false }).done(function (data)
{
    currentStepContent.empty().html(data)._aria("busy", "false").data("loaded", "1");

    var nextStep = '#wizard #wizard-p-' + state.currentIndex;
    var totalHeight = 0;
    $(nextStep).children().each(function () {
        totalHeight += $(this).outerHeight(true);
    });
    var padding = $(nextStep).innerHeight() - $(nextStep).height();
    totalHeight += padding;

    $(nextStep).parent().animate({ minHeight: totalHeight }, 200);
});

tharban avatar Mar 04 '14 09:03 tharban

This is what I did...

In the - jquery.steps.js search for

stepTitles.eq(state.currentIndex).addClass("current").next(".body").addClass("current");

Should be around line 844. Directly after, add:

stepTitles.eq(state.currentIndex).next(".body").each(function () {
    var bodyHeight = $(this).height();
    var padding = $(this).innerHeight() - bodyHeight;
    bodyHeight += padding;
    $("html, body").animate({ scrollTop: 0 }, "slow");    // Ensures each page starts at the top
    $(this).after('<div class="' + options.clearFixCssClass + '"></div>');
    $(this).parent().animate({ height: bodyHeight }, "slow");
});

rherring avatar Mar 07 '14 20:03 rherring

For vertical step by step accommodate the full content like this

updated jquery.steps.css file like below

  1. line 146 update overflow: hidden ------> overflow: auto;
  2. line 166 position: absolute ----- > delete

if you want to change min height update this 3) line 145 min-height: 35em; ----> as per requirements

java2fun avatar Apr 24 '14 18:04 java2fun

Thanks for all your support, when do you think about a new realease with this enhancenment? We wanna use this library but with that problem is impossible in our app, thanks

xxnull avatar May 16 '14 18:05 xxnull

Planned for version 2.0.0

rstaib avatar May 27 '14 10:05 rstaib

Duplicate of https://github.com/rstaib/jquery-steps/issues/8

I would recommend @rherring's fix, but be aware that you also need to override/modify the CSS as follows:

.wizard > .content {
    min-height: 0;
}
.wizard > .content > .body {
    height: auto;
}

maltem-za avatar Oct 22 '14 14:10 maltem-za

This problem is an unfortunate for this very useful library. I used @rherring's fix and @maltem-za's adds.

volkanozyilmaz avatar Aug 18 '15 13:08 volkanozyilmaz

here is my solution:

assuming standard height of 500px,

    onStepChanged: function (event, currentIndex, priorIndex) {
        console.log('currentIndex=' + currentIndex)
        var nHeight = "500px"; //<= default height
        if (currentIndex == 1) {
            var nHeight = "2000px"; //<= set new height here
        }

//example-basic is the name of the wizard $('#example-basic-p-' + currentIndex).parent().height(nHeight); }

soongsta avatar Jan 28 '17 07:01 soongsta

Just change .wizard > .content > .body{ position: absolute; } To .wizard > .content > .body{ position: relative; }

himalaym avatar Oct 25 '17 12:10 himalaym

I got also a problem ...

The content are different categories to choose and i have a (toggle "read more" button) for each category. So the content of each category switch down and you can read more.

The problem is it works perfectly when the content is not in the section. Inside the section, to create for example Step 1 it doesn´t work. Clicking the button works, but it doesn´t switch down.

Maybe somebody got an solution for me... thx

Fredination avatar Nov 22 '17 17:11 Fredination

This still isn't fixed. If i get time i'l be sure to send a PR soon.

izshreyansh avatar Nov 28 '18 12:11 izshreyansh

En la última versión jQuery Steps v1.1.0 - 09/04/2014 con el asistente https://colorlib.com/etc/bwiz/colorlib-wizard-19/index.html Quite los estilos predeterminados y, además que la altura del contenido en cada paso se ajuste automáticamente. Me funcionó de la siguiente manera en el archivo css/style.css en lo siguiente:

  1. comente las líneas desde 59 hasta la 82, esto es body, .main y .container
  2. en la línea 212 en height: 410px; cambio por height: auto;, esto es en .content
  3. en la línea 479 en height: 550px; cambio por height: auto;, esto es en @media screen and (max-width: 768px) > .content Y por último en el html después de la etiqueta
    , agregue algunos saltos de línea
    (se que no es la mejor forma), ya que los botones se sobreponían en el contenido.

PaolitaGalarza avatar Feb 11 '21 00:02 PaolitaGalarza