-
-
Save eicu/db0d1464b2fd404f3882 to your computer and use it in GitHub Desktop.
ionic slide box dynamic height - fixes the issue where the slide boxes aren't taking up the full height of the device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 height of viewport | |
var newHeight = window.getComputedStyle(elem.parents('ion-content')[0], null).getPropertyValue("height"); | |
if (parseInt(newHeight) > 0) { | |
var ionScrollTag = elem.find('ion-scroll')[0]; | |
ionScrollTag.style.height = newHeight; | |
} | |
}); | |
} | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-content> | |
<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> | |
</ion-content> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much for this fix ! <3