Skip to content

Instantly share code, notes, and snippets.

@vwochnik
Created September 28, 2015 18:10
Show Gist options
  • Select an option

  • Save vwochnik/1479adbecb0583e37cd5 to your computer and use it in GitHub Desktop.

Select an option

Save vwochnik/1479adbecb0583e37cd5 to your computer and use it in GitHub Desktop.
Scss overlay mixin
<html>
<head>
<title>Test</title>
<!-- include stylesheet -->
</head>
<body>
<div class="overlay"></div>
</body>
<!-- include jQyery -->
<!-- include javascript -->
</html>
/*
* Overlay mixin with fade animation
*/
@mixin overlay($position, $z-index, $duration) {
position: $position;
left: 0; top: 0;
width: 100%; height: 0;
z-index: $z-index;
@include transition(opacity $duration ease-in-out, height 0s linear, visibility 0s linear);
visibility: hidden;
overflow: hidden;
@include opacity(0.0);
&.fade-out {
@include transition(opacity $duration ease-in-out, height 0s linear $duration, visibility 0s linear $duration);
}
&.visible {
height: 100%;
visibility: visible;
@include opacity(1.0);
}
}
(function($) {
})(jQyery);
.overlay {
@include overlay(fixed, 99, 1s);
background-color: rgba(0, 0, 96, 0.4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment