Friday, June 19, 2015

Simple Responsive menu bar

Posted by dientudieukhien at 8:33 PM 0 Comments
Responsive menu bar rất phù hợp với các blog đơn giản, phù hợp với pc và mobile, sau đây là một số hình ảnh thực tế:
simple responsive menu bar
Menu khi ở độ phân giải màn hình lớn

simple responsive menu bar
Menu khi thu gọn
Các bước cài đặt menu bar như sau:


  • Bước 2: upload file "scrip.js" lên một host mà mình có thể lấy public link (ví dụ như dropbox.com...) có dạng như sau: https://dl.dropboxusercontent.com/u/account/js/js/script.js
  • Bước 3: vào CP của blogspot, vào chỉnh sửa html của mẫu, tìm </head>, paste đoạn mã sau phía trên nó:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="script.js"></script>
* Bạn thay script.js  trong đoạn code trên bằng địa chỉ file script.js bạn upload ở Bước 2.

  • Bước 4: Trong "Mẫu" tìm </b:sink>, paste đoạn code sau phía trên nó.
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a,
#cssmenu #menu-button {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  line-height: 1;
  display: block;
  position: relative;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
  content: ".";
  display: block;
  clear: both;
  visibility: hidden;
  line-height: 0;
  height: 0;
}
#cssmenu #menu-button {
  display: none;
}
#cssmenu {
  width: auto;
  border: 3px solid #fd8a17;
  border-radius: 3px;
  font-family: 'Oswald', sans-serif;
  line-height: 1;
  background: #f7f7f7;
  box-shadow: 1px 1px 0 #df7002, 2px 2px 0 #df7002, 3px 3px 3px rgba(0, 0, 0, 0.35);
}
#cssmenu > ul {
  background: url('images/bg.png');
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu.align-center > ul {
  font-size: 0;
  text-align: center;
}
#cssmenu.align-center > ul > li {
  display: inline-block;
  float: none;
}
#cssmenu.align-right > ul > li {
  float: right;
}
#cssmenu > ul > li > a {
  padding: 20px 25px;
  font-size: 14px;
  text-transform: uppercase;
  text-decoration: none;
  color: #fd8a17;
  -webkit-transition: all .2s ease;
  -moz-transition: all .2s ease;
  -ms-transition: all .2s ease;
  -o-transition: all .2s ease;
  transition: all .2s ease;
}
#cssmenu > ul > li > a:hover,
#cssmenu > ul > li:hover > a,
#cssmenu > ul > li.active > a {
  color: #444444;
}
#cssmenu #menu-indicator {
  position: absolute;
  bottom: 0;
  display: block;
  height: 0;
  width: 0;
  border: 5px solid transparent;
  border-bottom-color: #fd8a17;
  -webkit-transition: all 0.25s ease-out;
  -moz-transition: all 0.25s ease-out;
  -ms-transition: all 0.25s ease-out;
  -o-transition: all 0.25s ease-out;
  transition: all 0.25s ease-out;
}
#cssmenu.small-screen {
  width: 100%;
}
#cssmenu.small-screen > ul,
#cssmenu.small-screen.align-center > ul {
  width: 100%;
  text-align: left;
}
#cssmenu.small-screen > ul > li,
#cssmenu.small-screen.align-center > ul > li {
  float: none;
  display: block;
  border-top: 1px solid rgba(100, 100, 100, 0.1);
}
#cssmenu.small-screen > ul > li > a {
  padding: 18px 25px;
}
#cssmenu.small-screen > ul > li:after,
#cssmenu.small-screen > ul > li:before {
  display: none;
}
#cssmenu.small-screen #menu-button {
  display: block;
  padding: 18px 25px;
  cursor: pointer;
  font-size: 14px;
  text-transform: uppercase;
  text-decoration: none;
  color: #fd8a17;
  background: url('images/bg.png');
}
#cssmenu.small-screen #menu-button.menu-opened {
  color: #444444;
}
#cssmenu.small-screen #menu-button:after {
  content: "";
  position: absolute;
  right: 25px;
  top: 19.5px;
  display: block;
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  border-top: 2px solid #fd8a17;
  border-bottom: 2px solid #fd8a17;
  width: 18px;
  height: 3px;
}
#cssmenu.small-screen #menu-button.menu-opened:after {
  border-top: 2px solid #444444;
  border-bottom: 2px solid #444444;
}
#cssmenu.small-screen #menu-button:before {
  content: "";
  position: absolute;
  right: 25px;
  top: 29.5px;
  display: block;
  width: 18px;
  height: 2px;
  background: #fd8a17;
}
#cssmenu.small-screen #menu-button.menu-opened:before {
  background: #444444;
}
#cssmenu.small-screen #menu-indicator {
  display: none;
}

  • Bước 5: Đặt đoạn code sau vào nơi bạn muốn xuất hiện menu bar

<div id='cssmenu'>
<ul>
   <li class='active'><a href='#'>Home</a></li>
   <li><a href='#'>Products</a></li>
   <li><a href='#'>Company</a></li>
   <li><a href='#'>Contact</a></li>
</ul>
</div>
* Bạn hoàn toàn có thể thay đổi nội dung, màu của menu bar

  • Video:

Click vào link tải ở trên đợi 5 giây, ấn "Bỏ qua quảng cáo". Click the link above, wait for 5s and click button "Skip Ad"

Chia sẽ bài viết này

Cập nhật tin bài mới

Subscribe địa chỉ mail để nhận tin nhanh chóng. Chúng tôi sẽ giữ bí mật địa chỉ mail của bạn.

0 nhận xét:

    tab

back to top