如果大于页面,制作一个(可折叠、自动调整大小且始终可见)面板显示滚动条?
我正在使用 asp.net 母版页;相关代码如下:
<body>
<form id="form1" runat="server">
<asp:Panel ID="pnlHeader_TopLeft" runat="server"
onmouseleave="$find('MenuCollapser').collapsePanel();">
<asp:Panel ID="pnlAppTitle" runat="server"
onmouseenter="$find('MenuCollapser').expandPanel();">
[my title bar]
</asp:Panel>
<asp:Panel ID="pnlMenuMain" Style="float: left; clear: both;
runat="server">
[my menu items]
</asp:Panel>
</asp:Panel>
<ajax:CollapsiblePanelExtender BehaviorID="MenuCollapser"
TargetControlID="pnlMenuMain" ExpandDirection="Vertical"
SuppressPostBack="true" Collapsed="true" runat="server" />
<ajax:AlwaysVisibleControlExtender TargetControlID="pnlHeader_TopLeft"
HorizontalSide="left" VerticalSide="Top" runat="server" />
</form>
</body>
这非常有效......除非 pnlMenuMain
的内容太多,以至于面板的高度扩展到页面之外,遮盖了其底部部分。有什么方法可以限制其最大高度,以便它在达到屏幕的最大高度之前停止扩展,并使用滚动条代替?
I'm working with an asp.net master-page; the relevant code is as follows:
<body>
<form id="form1" runat="server">
<asp:Panel ID="pnlHeader_TopLeft" runat="server"
onmouseleave="$find('MenuCollapser').collapsePanel();">
<asp:Panel ID="pnlAppTitle" runat="server"
onmouseenter="$find('MenuCollapser').expandPanel();">
[my title bar]
</asp:Panel>
<asp:Panel ID="pnlMenuMain" Style="float: left; clear: both;
runat="server">
[my menu items]
</asp:Panel>
</asp:Panel>
<ajax:CollapsiblePanelExtender BehaviorID="MenuCollapser"
TargetControlID="pnlMenuMain" ExpandDirection="Vertical"
SuppressPostBack="true" Collapsed="true" runat="server" />
<ajax:AlwaysVisibleControlExtender TargetControlID="pnlHeader_TopLeft"
HorizontalSide="left" VerticalSide="Top" runat="server" />
</form>
</body>
This works perfectly....unless the contents of pnlMenuMain
are so numerous that the panel's height expands beyond the page, obscurring its bottom portion. Is there some way that I can cap its maximum height so that it stops expanding before reaching the screen's max height, and uses a scrollbar instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会在评论中回复,但目前我的代表太低了。您应该能够设置面板的高度属性,然后更改面板的属性以包括
静态高度属性将阻止其自动扩展页面,并且滚动条属性应该允许您在菜单选项打开时看到所有选项。数量巨大,超出页面范围。
I'd respond in a comment, but my rep is too low at the time being. You should be able to set the height property of the panel and then change the properties of your panel to include
The static height property will keep it from automatically expanding the page and the scrollbars attribute should allow you to see all options when the menu options are great in number and go off the page.