手写侧边超炫工具栏

先来张效果图:

如下为核心代码:

-- index.htm

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<link rel="stylesheet" href="css/index.css" />
</head>
<body>

<div class="toolbar">
    <a href="javascript:;" class="toolbar-item toolbar-item-weixin">
        <span class="toolbar-layer"></span>
    </a>
    <a href="javascript:;" class="toolbar-item toolbar-item-feedback"></a>
    <a href="javascript:;" class="toolbar-item toolbar-item-app">
        <span class="toolbar-layer"></span>
    </a>
    <a href="javascript:;" class="toolbar-item toolbar-item-top"></a>
</div>

</body>
</html>

 

--index.css

.toolbar {
  position: fixed;
  left: 100%;
  bottom: 5px;
  margin-left: -57px; }

.toolbar-item {
  position: relative;
  display: block;
  width: 52px;
  height: 52px;
  background-image: url(../img/toolbar.png);
  background-repeat: no-repeat;
  margin-top: 1px;
  transition: background-position 1s; }
  .toolbar-item:hover .toolbar-layer {
    opacity: 1;
    filter: alpha(opacity=100);
    transform: scale(1); }

.toolbar-item-weixin {
  background-position: 0 -798px; }
  .toolbar-item-weixin:hover {
    background-position: 0 -860px; }
  .toolbar-item-weixin .toolbar-layer {
    height: 212px;
    background-position: 0 0; }

.toolbar-item-feedback {
  background-position: 0 -426px; }
  .toolbar-item-feedback:hover {
    background-position: 0 -488px; }

.toolbar-item-app {
  background-position: 0 -550px; }
  .toolbar-item-app:hover {
    background-position: 0 -612px; }
  .toolbar-item-app .toolbar-layer {
    height: 194px;
    background-position: 0 -222px; }

.toolbar-item-top {
  background-position: 0 -674px; }
  .toolbar-item-top:hover {
    background-position: 0 -736px; }

.toolbar-layer {
  position: absolute;
  right: 46px;
  bottom: -10px;
  width: 172px;
  background-image: url(../img/toolbar_img.png);
  background-repeat: no-repeat;
  opacity: 0;
  filter: alpha(opacity=0);
  transform-origin: 95% bottom;
  transform: scale(0.01);
  transition: all 1s; }

posted @ 2015-07-11 20:59  Gavin.King  阅读(146)  评论(0)    收藏  举报