AngularJS滚动问题(AngularJS Scrolling Issue)

编程入门 行业动态 更新时间:2024-10-23 15:18:05
AngularJS滚动问题(AngularJS Scrolling Issue)

我有一个加载多个视图的Container

<md-content flex id="content"> <div ng-view></div> </md-content>

例如,加载的其中一个视图看起来像这样

<div layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content id="MathContent"> [SomeContent] </md-content> </div>

问题是,如果“MathContent”中的内容太多,则NG-View Div变为可滚动而不是“MathContent”Md-Content,因为[Header Row]应该具有固定位置,所以不需要。

是否有可能禁止元素(例如ng-view)可以滚动或者我可以将选择白框的最大尺寸锁定到ng-view的高度?

I have a Container that loads multiple views

<md-content flex id="content"> <div ng-view></div> </md-content>

For Example one of those views loaded looks like this

<div layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content id="MathContent"> [SomeContent] </md-content> </div>

The Problem is, that if there is too much Content in "MathContent", the NG-View Div becomes Scrollable and not the "MathContent" Md-Content whats not wanted because the [Header Row] should have a fixed position.

Is it somehow possible to prohibit an Element (for example the ng-view) from beeing scrollable or can I lock the Maximum Size of selection-whiteframe to the height of the ng-view?

最满意答案

这有点棘手,要让它在Chrome中运行,您只需要在每个级别添加layout="column/row" 。

<body layout="column"> <md-content layout="column" flex id="content"> <div layout="column" ng-view> <div layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content layout="column" id="MathContent"> [SomeContent] </md-content> </div> </div> </md-content>

但这在Firefox中不起作用。 为了使它在任何地方都能工作,你还需要用md-content替换所有div 。

<body layout="column"> <md-content layout="column" flex id="content"> <md-content layout="column" ng-view> <md-content layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content layout="column" id="MathContent"> [SomeContent] </md-content> </md-content> </md-content> </md-content>

这是一个简单的codepen,我在这里引用你的答案: https ://stackoverflow.com/a/29516060/2553215

http://codepen.io/kuhnroyal/pen/GZoRwz

This is a bit tricky, to make it work in Chrome you just need to add layout="column/row" on every level.

<body layout="column"> <md-content layout="column" flex id="content"> <div layout="column" ng-view> <div layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content layout="column" id="MathContent"> [SomeContent] </md-content> </div> </div> </md-content>

But this will not work in Firefox. To make it work everywhere, you need to also replace all the div's with md-content.

<body layout="column"> <md-content layout="column" flex id="content"> <md-content layout="column" ng-view> <md-content layout="column" id="selection-whiteframe" ng-controller="MathCtrl"> [Header Row Here] <md-content layout="column" id="MathContent"> [SomeContent] </md-content> </md-content> </md-content> </md-content>

Here is a simple codepen and I refer you to my answer here: https://stackoverflow.com/a/29516060/2553215

http://codepen.io/kuhnroyal/pen/GZoRwz

更多推荐

本文发布于:2023-08-07 20:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465967.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AngularJS   Scrolling   Issue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!