Coder Social home page Coder Social logo

Scroll to top about md-steppers HOT 3 CLOSED

jpnkicker14 avatar jpnkicker14 commented on August 15, 2024
Scroll to top

from md-steppers.

Comments (3)

jpnkicker14 avatar jpnkicker14 commented on August 15, 2024 1

@ipiz Thanks for the quick reply!
Unfortunately I couldn't get it to work quite right (possibly because of my specific layout where the steps are inside a scrollable div). But, I found an angular scroll directive (https://github.com/oblador/angular-scroll) that ended up working just fine.

from md-steppers.

roelbarreto avatar roelbarreto commented on August 15, 2024

@jpnkicker14 you can use $anchorScroll and $location.hash

<div id="the-anchor">
    <md-steppers>
        <md-step>
            <!-- code here -->
            <md-button ng-click="vm.saveStepAndForward('the-anchor')">
        </md-step>
        <md-step>
            <!-- code here -->
            <md-button ng-click="vm.saveStepAndForward('the-anchor')">
        </md-step>
    </md-steppers>
</div>
//example
function gotoAnchor(x) {
    var newHash = x;
    if ($location.hash() !== newHash) {
        // set the $location.hash to `newHash` and
        // $anchorScroll will automatically scroll to it
        $location.hash(x);
    } else {
        // call $anchorScroll() explicitly,
        // since $location.hash hasn't changed
        $anchorScroll();
    }
}
vm.saveStepAndForward = saveStepAndForward;
function saveStepAndForward(anchor) {
    vm.stepBusy = true;
    gotoAnchor(anchor);
    $timeout(function () {
        vm.activeStep = 2;
        vm.steps.step1.completed = true;
        vm.steps.step2.enabled = true;
        vm.stepBusy = false;
    }, 1000);
}

from md-steppers.

roelbarreto avatar roelbarreto commented on August 15, 2024

@jpnkicker14 here is a fiddle for you:

https://jsfiddle.net/vcdbuyru/3/

from md-steppers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.