scss 侧边栏_图片

html

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>侧边栏</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="toolbar">
<a href="javascript:;" class="toobar-item toolbar-item-weixin">
<span class="toolbar-layer">

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

</span>
</a>
<a href="javascript:;" class="toobar-item toolbar-item-top"></a>
</div>
</body>
</html>

style.scss

@import "mixin";
@import "toolbar";

mixin.scss

@mixin transition ($transition) {
-webkit-transition:$transition;
-moz-transition:$transition;
-ms-transition:$transition;
-o-transition: $transition;
transition: $transition;
}

@mixin transform-origin ($origin){
-webkit-transform-origin: $origin;
-moz-transform-origin: $origin;
-ms-transform-origin: $origin;
-o-transform-origin: $origin;
transform-origin: $origin;
}
@mixin scale($scale){
-webkit-transform: scale($scale);
-moz-transform: scale($scale);
-ms-transform: scale($scale);
-o-transform: scale($scale);
transform: scale($scale);
}

@mixin opacity($opacity){
opacity: $opacity;
filter: alpha(opacity=$opacity * 100);
}

toolbar.scss

@mixin toobar-item($pos, $hoverPos){
background-position:0 $pos;
&:hover{
background-position:0 $hoverPos;
}
}

$toolbar-size:52px;
.toobar-item,.toolbar-layer{
background-image:url(../images/toolbar.png);
background-repeat:no-repeat;
}
.toolbar{
position:fixed;
left:50%;
margin-left:-$toolbar-size / 2;
bottom:50px;
}
.toobar-item{
position:relative;
display:block;
width:$toolbar-size;
height:$toolbar-size;
margin-top:1px;
@include transition(background-position 1s);
&:hover{
.toolbar-layer{
@include scale(1);
@include opacity(1);
}
}
}
.toolbar-item-weixin{
@include toobar-item(-798px, -860px);
.toolbar-layer{
height:212px;
background-position:0 0;
}
}

.toolbar-item-feedback{
@include toobar-item(-426px, -488px);
}
.toolbar-item-app{
@include toobar-item(-550px, -612px);
.toolbar-layer{
height:194px;
background-position:0 -222px;
}
}
.toolbar-item-top{
@include toobar-item(-674px, -736px);
}
.toolbar-layer{
position:absolute;
right: $toolbar-size - 6;
bottom:-10px;
width: 172px;
@include opacity(0);
@include scale(0.01);
@include transition(all 1s);
@include transform-origin (95% 95%);
}

 编译后的css

.toobar-item, .toolbar-layer {
background-image: url(../images/toolbar.png);
background-repeat: no-repeat; }

.toolbar {
position: fixed;
left: 50%;
margin-left: -26px;
bottom: 50px; }

.toobar-item {
position: relative;
display: block;
width: 52px;
height: 52px;
margin-top: 1px;
-webkit-transition: background-position 1s;
-moz-transition: background-position 1s;
-ms-transition: background-position 1s;
-o-transition: background-position 1s;
transition: background-position 1s; }
.toobar-item:hover .toolbar-layer {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
opacity: 1;
filter: alpha(opacity=100); }

.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;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transform: scale(0.01);
-moz-transform: scale(0.01);
-ms-transform: scale(0.01);
-o-transform: scale(0.01);
transform: scale(0.01);
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
-webkit-transform-origin: 95% 95%;
-moz-transform-origin: 95% 95%;
-ms-transform-origin: 95% 95%;
-o-transform-origin: 95% 95%;
transform-origin: 95% 95%; }

/*# sourceMappingURL=style.css.map */

上一篇:iOS常用宏 定义


下一篇:AndroidQ RRO(Runtime Resource Overlay)机制(4)