ui-layout icon indicating copy to clipboard operation
ui-layout copied to clipboard

A fake media query for responsive panes

Open mohsen1 opened this issue 11 years ago • 5 comments
trafficstars

I would like to apply different classes for different ranges of width/height of a pane. If I had the width attribute in scope I could do:

<div ui-layout>
  <div ng-class="{
    small: width < 100,
    medium: width > 100 && width < 400,
    large: width > 400
  }"></div>
</div>

But I don't have access to width which is internal to directive.

A better solution would be some sort of fake media query to make it easier to write such code. One solution could be this:

<div ui-layout>
  <div size-class="{
  small: { max: 100 }, 
  medium: {min: 100, max: 400},
  large: {min: 400}
  }"></div>
</div>

Above solution is vertical/horizontal independent and doesn't need exposing width

mohsen1 avatar Aug 24 '14 20:08 mohsen1

Same here. Is there a way to reset the options from the page controller? Or even a public reset method to pass the option in depending the viewport.

ticlaudeberube avatar Aug 27 '14 15:08 ticlaudeberube

One alternative is https://github.com/kumailht/responsive-elements.

tristanz avatar Feb 07 '15 09:02 tristanz

I had it working with the latest update. Just put a sniffer at the controller with a {{}} in the partial view.

$scope.panes = { sizes: { left: '50%', right: '50%', splitTop: '50%', dividerSize: '14' }};

ui-layout-container size="{{panes.sizes.left}}" id="schematic" class="row schematicPanel ui-layout-container size="{{panes.sizes.left}}"

ticlaudeberube avatar Feb 07 '15 19:02 ticlaudeberube

I was struggling with this issue, and I ended creating a fake media query system that was really buggy. Then I realized using Flexbox for the layout inside the view fit the bill for my needs. Might want to give a try.

jongunterfv avatar Dec 17 '15 23:12 jongunterfv

@jongunterfv : would you mind giving an example of how you got this to work ? thanks!

jmls avatar Nov 17 '16 13:11 jmls