shape1
shape2
shape3
shape4
shape7
shape8

[CEF] Меню 1.0


Fantomxx

Освоившийся
Пользователь
25.11.2021
97
29
0
Всем привет. Хочу показать пример реализации меню в CEF не стандартным способом, а сбоку. Темку буду обновлять. Ибо это не окончательный вариант.

Для начала, создадим HTML файл и впишем туда следующие строки:

Код:
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.
min.css">
  </head>
  <body>
    <div class="wrapper">
      <input type="checkbox" id="btn" hidden>
      <label for="btn" class="menu-btn">
        <i class="fas fa-bars"></i>
        <i class="fas fa-times"></i>
      </label>
      <nav id="sidebar">
        <div class="title">Меню сервера</div>
        <ul class="list-items">
          <li><a href="#"><i class="fa fa-location-arrow"></i>Строка 1</a></li>
          <li><a href="#"><i class="fas fa-user"></i>Строка 2</a></li>
          <li><a href="#"><i class="fas fa-address-book"></i>Строка 3</a></li>
          <li><a href="#"><i class="fas fa-cog"></i>Строка 4</a></li>             
          <div class="icons">
            <a href=""><i class="fab fa-youtube"></i></a>
            <a href=""><i class="fab fa-discord"></i></a>
            <a href=""><i class="fab fa-vk"></i></a>
          </div>
        </ul>
      </nav>
    </div>
  </body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
            $(this).keydown(function(eventObject){
                if (eventObject.which == 27) //буква ESC
                {
                        cef.hide(true);
                        cef.set_focus(false);
                }
                    
            });
</script>
</html>

Далее создадим файл style.css и впишем туда следующие строки

Код:
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;
600;700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
.wrapper{
  height: 100%;
  width: 300px;
  position: relative;
}
.wrapper .menu-btn{
  position: absolute;
  left: 20px;
  top: 900px;
  background: #4a4a4a;
  color: #fff;
  height: 45px;
  width: 45px;
  z-index: 9999;
  border: 1px solid #333;
  border-radius: 65px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
#btn:checked ~ .menu-btn{
  left: 317px;
}
.wrapper .menu-btn i{
  position: absolute;
  transform: ;
  font-size: 23px;
  transition: all 3.3s ease;
}
.wrapper .menu-btn i.fa-times{
  opacity: 0;
}
#btn:checked ~ .menu-btn i.fa-times{
  opacity: 1;
  transform: rotate(-1080deg);
}
#btn:checked ~ .menu-btn i.fa-bars{
  opacity: 0;
  transform: rotate(1080deg);
}
#sidebar{
  position: fixed;
  background: #404040;
  height: 100%;
  width: 370px;
  overflow: hidden;
  left: -370px;
  transition: all 0.3s ease;
}
#btn:checked ~ #sidebar{
  left: 0;
}
#sidebar .title{
  line-height: 65px;
  text-align: center;
  background: #333;
  font-size: 25px;
  font-weight: 600;
  color: #f2f2f2;
  border-bottom: 1px solid #222;
}
#sidebar .list-items{
  position: relative;
  background: #404040;
  width: 100%;
  height: 100%;
  list-style: none;
}
#sidebar .list-items li{
  padding-left: 40px;
  line-height: 50px;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid #333;
  transition: all 0.3s ease;
}
#sidebar .list-items li:hover{
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  box-shadow: 0 0px 10px 3px #222;
}
#sidebar .list-items li:first-child{
  border-top: none;
}
#sidebar .list-items li a{
  color: #f2f2f2;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  height: 400%;
  width: 400%;
  display: block;
}
#sidebar .list-items li a i{
  margin-right: 20px;
}
#sidebar .list-items .icons{
  width: 100%;
  height: 40px;
  text-align: center;
  position: absolute;
  bottom: 100px;
  line-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#sidebar .list-items .icons a{
  height: 100%;
  width: 40px;
  display: block;
  margin: 0 5px;
  font-size: 18px;
  color: #f2f2f2;
  background: #4a4a4a;
  border-radius: 5px;
  border: 1px solid #383838;
  transition: all 0.3s ease;
}
#sidebar .list-items .icons a:hover{
  background: #404040;
}
.list-items .icons a:first-child{
  margin-left: 0px;
}
.content{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  color: #202020;
  z-index: -1;
  width: 100%;
  text-align: center;
}
.content .header{
  font-size: 45px;
  font-weight: 700;
}
.content p{
  font-size: 40px;
  font-weight: 700;
}

В pawno прописываем
В начало мода


Код:
#define CEF_INTERFACE_BROWSER_ID 1

Ко всем командам

Код:
CMD:exit(playerid,params[])
{
    cef_destroy_browser(playerid, CEF_INTERFACE_BROWSER_ID);
    cef_create_browser(playerid, CEF_INTERFACE_BROWSER_ID, "", false, false); // опирайтесь на свой ID
    return true;
}

На этом все. Автор системы NiceXplayer
 
  • Like
Реакции: db9vol