简体   繁体   中英

asp.net c# panel screen size change

I want to remove one menu an replace it with another when my screensize is 480px.

I think the easiest way for me is to create two panels, then set menu1 to false when screen size is < 480px - and menu 2 to true

and when the screen size is > 481px menu2 to false and menu1 to true, you know:

if (... < 480)
{
menu1.Visible = false;
menu2.Visible = true;
}

if (... > 481)
{
menu1.Visible = true;
menu2.Visible = false;
}

Is this possible. Im using bootstrap if this gives you a better picture. Thanks.

A simple bootstrap solution could be using the hidden class. Your two menus could be as follows:

<div class="hidden-xs hidden-sm">

</div>

<div class="hidden-md hidden-lg">

</div>

The first div would be hidden on extra small and small displays. The second div would be hidden on medium and large displays. If you wanted to be more precise on screen size I would say use the CSS Media Query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM