Skip to content

Instantly share code, notes, and snippets.

@DarrylD
Created February 14, 2015 22:02
Show Gist options
  • Save DarrylD/1bb7fddf89f8b00d4f6a to your computer and use it in GitHub Desktop.
Save DarrylD/1bb7fddf89f8b00d4f6a to your computer and use it in GitHub Desktop.

Revisions

  1. DarrylD created this gist Feb 14, 2015.
    16 changes: 16 additions & 0 deletions directive.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    app.directive('dynamicHeight', function() {
    return {
    require: ['^ionSlideBox'],
    link: function(scope, elem, attrs, slider) {
    scope.$watch(function() {
    return slider[0].__slider.selected();
    }, function(val) {
    //getting the heigh of the container that has the height of the viewport
    var newHeight = window.getComputedStyle(elem.parent()[0], null).getPropertyValue("height");
    if (newHeight) {
    elem.find('ion-scroll')[0].style.height = newHeight;
    }
    });
    }
    };
    })
    11 changes: 11 additions & 0 deletions view.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <ion-slide-box>

    <ion-slide class="slide" dynamic-height>
    <ion-scroll>
    <div class="slide-box box">
    <!-- your stuff -->
    </div>
    </ion-scroll>
    </ion-slide>

    </ion-slide-box>