Last active
April 28, 2017 15:41
-
-
Save danielrw7/83f4e762c0bd0c8cb97b2d87cfbd48c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var overlay = { | |
el: false, | |
class: 'overlay', | |
show: function(clickCallback) { | |
this.el.show() | |
if (clickCallback && typeof clickCallback == "function") { | |
this.el.off('click').click(clickCallback) | |
} | |
}, | |
hide: function() { | |
this.el.hide() | |
}, | |
init: function() { | |
if (!this.el || !this.el.length) { | |
this.el = $('.'+this.class) | |
} | |
if (!this.el || !this.el.length) { | |
this.el = $('<div>', { | |
class: this.class | |
}) | |
} | |
$('body').append(this.el) | |
}, | |
} | |
overlay.show = overlay.show.bind(overlay) | |
overlay.hide = overlay.hide.bind(overlay) | |
overlay.init = overlay.init.bind(overlay) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.overlay { | |
display: none; | |
position: fixed; | |
left: 0; | |
right: 0; | |
top: 0; | |
bottom: 0; | |
background-color: rgba(0,0,0,0.3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment