Skip to content

Instantly share code, notes, and snippets.

@brunoksato
Created January 15, 2016 18:25
Show Gist options
  • Save brunoksato/01a6914cddbf04aa3bb7 to your computer and use it in GitHub Desktop.
Save brunoksato/01a6914cddbf04aa3bb7 to your computer and use it in GitHub Desktop.
Modal tela cheia
//html
<!--Start of Modal -->
<div class="modaal">
<input id="modaal__trigger" type="checkbox" />
<label class="{{className}}" for="modaal__trigger">{{buttonText}}</label>
<div class="modaal__overlay" role="dialog" aria-labelledby="modaal__title" aria-describedby="modaal_desc">
<div class="modaal__wrap">
<label for="modaal__trigger">&#10006;</label>
<ng-transclude></ng-transclude>
</div>
</div>
</div>
<!--End of Modal -->
//js
(function() {
'use strict';
angular
.module('quiddApp')
.directive('modal', modal);
/** @ngInject */
function modal($rootScope){
var directive = {
restrict: 'AE',
templateUrl: 'app/components/modal/modal.html',
scope: {
buttonText: '@',
className: '@'
},
link: modalLink,
transclude: true
};
return directive;
function modalLink($scope, $element, $attrs){
}
}
})();
//scss
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,900);
@import url(http://fonts.googleapis.com/css?family=Audiowide);
$lato: 'Lato', sans-serif;
//color
$yellow: #FFD300;
$white: #f2f1f1;
$black: #000000;
$black-light: #5E5E5E;
//font weights:
$thin: 300;
$normal: 400;
$bold: 900;
/*====================================
Our Modal Window styles
=====================================*/
.modaal__overlay {
background: #FFF;
bottom: 0;
left: 0;
position: fixed;
right: 0;
text-shadow: none;
top: 0;
z-index: 800;
}
.modaal__wrap {
padding: 0em 0;
position: relative;
margin: 0 auto;
max-width: 900px;
width: 90%;
}
@media (min-width: 50em) {
.modaal__wrap {
padding: 0em;
}
}
@media (min-height: 37.5em) {
.modaal__wrap {
left: 50%;
position: absolute;
top: 70%;
transform: translate(-50%, -80%);
}
}
.modaal__wrap > label {
background: #FFD300;
border-radius: 50%;
color: #000000;
cursor: pointer;
display: inline-block;
height: 1.5em;
line-height: 1.5;
position: absolute;
right: -5em;
top: -3em;
width: 1.5em;
text-align: center;
}
.modaal input:focus ~ label {
transform: scale(0.97);
}
input#modaal__trigger{
position: absolute;
top: -1000px;
}
.modaal__overlay {
opacity: 0;
transform: scale(0.5);
transition: all 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55);
z-index: -100;
}
input:checked ~ .modaal__overlay {
opacity: 1;
transform: scale(1);
z-index: 9999999;
}
//example usando
<modal button-text="Create New" class-name="btn btn-success">
<div ng-controller="MainController as vm" ng-include="'app/main/main.html'"></div>
</modal>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment