How can i minimize the side bar in my website while opening another page?

user6466895

I am working on a portal, currently designing the UI. I am using frameset here. I need to minimise the left frame (ie Sidebar/Menu) when I click on any link in the sidebar and the web page loads up in the right(Right) frame. The minimised version of the sidebar only display the icons of the tabs and I want an arrow key which will again maximize the sidebar if clicked. a

Here is the code for my frame.html

<!DOCTYPE html>
<html>
  <frameset cols="15%,*" scrolling="yes">
  <frame name = "left" src="menu.html" scrolling="yes">
  <frame name = "center">
</frameset>
</html>

my code for sidebar/menu is menu.html

<!DOCTYPE html>
<html>
<head>

<!--Link to the CSS style sheet-->
<link rel="stylesheet" href="css/menu.css">
<script src="https://kit.fontawesome.com/5c399403c6.js"></script>
</head>

<body>
<!--Sidebar/Menu-->
<div class="wrapper">
  <div class="menu">
    <!--Logo comes here-->
    <h2>Alfred</h2>

    <!--Search Bar-->
    <div class="search">



    <!--Links in the sidebar/menu-->
   <ul>
     <li><input class="search-text" type="text" placeholder="Search here" name="">
     <a class="search-button" href="#">
       <i class="fas fa-search"></i>
     </li>
    <li><i class="fas fa-chart-line"></i><a href="dashboard.html" target ="center" >Dashboard</a></li>
    <li><i class="fas fa-building"></i><a href="hq.html"target ="center" >HQ</a></li>
    <li><i class="fas fa-file-invoice-dollar"></i><a href="accounts.html"target ="center">Accounts</a></li>
    <li><i class="fas fa-users"></i><a href="people.html"target ="center">People</a></li>
    <li><i class="fas fa-at"></i><a href="mail.html"target ="center">Mail</a></li>
    <li><i class="fas fa-handshake"></i><a href="crm.html"target ="center">CRM</a></li>
    <li><i class="fas fa-calendar-alt"></i><a href="calendar.html"target ="center">Calendar</li>
    <li><i class="fas fa-clipboard-list"></i><a href="board.html"target ="center">Board</a></li>
    <li><i class="fas fa-archive"></i><a href="files.html"target ="center">Files</a></li>
    <li><i class="fas fa-headset"></i><a href="desk.html"target ="center">Support Desk</a></li>
    <li><i class="fas fa-cogs"></i><a href="settings.html"target ="center">Settings</li>
  </ul>
  </div>
  </div>
</body>
</html>

and my stylesheet is menu.css

@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
@import url('https://fonts.googleapis.com/css?family=Raleway&display=swap');

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
  font-family: 'Muli', sans-serif;
}

i{
  margin: 10px;

}

body{
  background: #391E57;
}

.wrapper{
  display: flex;
  position: relative;
  color: #ECE4F4;

}

.wrapper .menu {
  position: fixed;
  width: 200px;
  height: 100%;
  background: #391E57;
  padding: 30px 0;

}

.wrapper .menu h2{
  color: #fff;
  text-align: center;
  margin-bottom: 30px;
  font-family: 'Raleway', sans-serif;
  letter-spacing: 4.5px;
  transition: all .2s ease-in-out;
}

.wrapper .menu h2:hover{
  color: #53D2F5;
  transform: scale(1.1);
}

.search-text{
  width: 140px;
  height: 25px;

}


.wrapper .menu ul li{
  padding: 5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  border-top: 1px solid rgba(225, 225, 225, 0.05);
}

.wrapper .menu ul li a{
  color: #9F9CA2;
  display: inline;

}

.wrapper .menu ul li .fas{
  width: 25px;
  color: #9F9CA2;
  transition: all .2s ease-in-out;

}

.wrapper .menu ul li:hover .fas{
  color: #53D2F5;
   transform: scale(1.1);
}


.wrapper .menu ul li:hover{
  background: #79668F;
}

.wrapper .menu ul li:hover a{
  color: #fff;
}
Mateus Wolkmer

There are a couple ways you could partially hide a sidemenu component, and it depends on how you structure the rest of your page. You could use margin, width, absolute positioning... One thing you will have to do for sure is toggle create a class for when the sidemenu is supposed to be full width, and when it is supposed to be partially open.

So lets say you choose to use width:

  1. Create a .hide class for your .wrapper .menu with the width you want when it is partially closed, like that:

    .wrapper .menu.hide { width: 50px; }

  2. Add the ID sidemenu to your component to be able to reference it better. Then, create a javascript function to toggle the sidemenu state (recommend using Jquery):

    toggleSidemenu = () => { $("#sidemenu").toggleClass("hide"); }

You can also create functions to always close or always open it, using $("#sidemenu").removeClass("hide"); and $("#sidemenu").addClass("hide");, they may come in handy.

  1. Call the toggleSidemenu function wherever you want to toggle it, like in a header button or whenever you change pages.

I also recommend adding a transition so that the transition between states is smooth, it looks a lot better. ;)

#sidemenu {
  position: fixed;
  width: 200px;
  height: 100%;
  background: #391E57;
  padding: 30px 0;
  -webkit-transition: width 2s
  transition: width 2s;
}

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I remove scroll bar in the bottom side of my division?

分類Dev

How can I access the column/bar total in my bar chart?

分類Dev

How can I make a button redirect my page to another page using a controller action and passing a value using javascript?

分類Dev

How can I find all the APIs of my website?

分類Dev

How can i center the slideshow in my website to be in the center of the screen?

分類Dev

How can I embed a Facebook Like Box in my website?

分類Dev

How can i set back navigation button in my action bar?

分類Dev

Magento - How can I tell if I'm on a "My Account" page?

分類Dev

In php how can I download images from external website and save into my website?

分類Dev

How can I bundle my database file into my app, ready for a side load install?

分類Dev

how to display my website on facebook page

分類Dev

Can I use the atto editor for my website?

分類Dev

How can I calibrate my printer using the LaTeX test page?

分類Dev

How can I add another database in my laravel project in heroku

分類Dev

How do I 301 redirect - for all urls of my website to one single page

分類Dev

Java: JButton opening another JFrame that I can input into

分類Dev

How to prevent my app from opening within another app?

分類Dev

Can I hide the Firefox title bar AND still see the close/minimize/maximize icons?

分類Dev

How can I disable searching and domain guessing from the Firefox Address Bar, while keeping other features?

分類Dev

How can I add a video to my website that plays when you click a button?

分類Dev

How can I create a simple page vertical scroll bar without using jQuery?

分類Dev

How can i put 3 divs side by side with a margin and a border?

分類Dev

How can I show this 2 div side by side?

分類Dev

I would like to make my menu bar scroll with the page

分類Dev

How can I catch all tooltips from my application & display it in Status bar in WinForms

分類Dev

These spaces are appearing to me suddenly while I'm writing my code, how can I remove them?

分類Dev

How can I add home-page sections in any page, other than home-page in my Shopify Store?

分類Dev

how can i set a link in website to button

分類Dev

How can I trigger dropdown while viewing asp.net page

Related 関連記事

  1. 1

    How can I remove scroll bar in the bottom side of my division?

  2. 2

    How can I access the column/bar total in my bar chart?

  3. 3

    How can I make a button redirect my page to another page using a controller action and passing a value using javascript?

  4. 4

    How can I find all the APIs of my website?

  5. 5

    How can i center the slideshow in my website to be in the center of the screen?

  6. 6

    How can I embed a Facebook Like Box in my website?

  7. 7

    How can i set back navigation button in my action bar?

  8. 8

    Magento - How can I tell if I'm on a "My Account" page?

  9. 9

    In php how can I download images from external website and save into my website?

  10. 10

    How can I bundle my database file into my app, ready for a side load install?

  11. 11

    how to display my website on facebook page

  12. 12

    Can I use the atto editor for my website?

  13. 13

    How can I calibrate my printer using the LaTeX test page?

  14. 14

    How can I add another database in my laravel project in heroku

  15. 15

    How do I 301 redirect - for all urls of my website to one single page

  16. 16

    Java: JButton opening another JFrame that I can input into

  17. 17

    How to prevent my app from opening within another app?

  18. 18

    Can I hide the Firefox title bar AND still see the close/minimize/maximize icons?

  19. 19

    How can I disable searching and domain guessing from the Firefox Address Bar, while keeping other features?

  20. 20

    How can I add a video to my website that plays when you click a button?

  21. 21

    How can I create a simple page vertical scroll bar without using jQuery?

  22. 22

    How can i put 3 divs side by side with a margin and a border?

  23. 23

    How can I show this 2 div side by side?

  24. 24

    I would like to make my menu bar scroll with the page

  25. 25

    How can I catch all tooltips from my application & display it in Status bar in WinForms

  26. 26

    These spaces are appearing to me suddenly while I'm writing my code, how can I remove them?

  27. 27

    How can I add home-page sections in any page, other than home-page in my Shopify Store?

  28. 28

    how can i set a link in website to button

  29. 29

    How can I trigger dropdown while viewing asp.net page

ホットタグ

アーカイブ