Farfromunique
Farfromunique

Reputation: 467

Javascript function call not executing

I have a function in pure JavaScript that flies out a div from the right. This could be written better, but I'm not worried about that right now.

If I manually call flyout(), it does what it's supposed to. If I call nextStep(), it does all the other stuff it's supposed to, except for calling flyout().

These functions are in the same file.

function flyout() {
    window.phases.style.left = window.innerWidth - (window.phases.style.width.replace("px","").valueOf());
    window.flown = true;
    phasesName = document.getElementById("phasesName");
    phasesBody = document.getElementById("phasesBody");

    phasesName.style.display = "none";
    phasesBody.style.display = "block";
}


function nextStep() {
    switch (window.stepName) {
        case "Step1":
            stepName = "Step2";
            step2();
            break;

        case "Step2":
            stepName = "Step3";
            step3();
            break;

        case "Step3":
            stepName = "Step4";
            step4();
            break;

        case "Step4":
            stepName = "Step5";
            step4();
            break;
    };
    flyout();
}

It does everything I want it to, except for calling flyout() function.

Upvotes: 1

Views: 267

Answers (2)

Farfromunique
Farfromunique

Reputation: 467

I'm an idiot. it is firing off, but it's being countered by a different function call immediately.

FWIW, the project is at https://github.com/farfromunique/vampirrePoints/ and yes, i know I typo'd vampire.

Upvotes: 0

David Corbin
David Corbin

Reputation: 514

The browser probably isn't getting down to the flyOut() call in nextStep(). Put console.log or alert about the flyOut() call in nextStep() and see if it is getting called.

Upvotes: 1

Related Questions