Created
September 25, 2014 12:53
-
-
Save obojdi/acf023e472d81e6a64fe to your computer and use it in GitHub Desktop.
overlay popup with height breakpoint
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 breakpoint_1 = 800; | |
function checkHeight(){ | |
var wh = $(window).height() || window.innerHeight || root.clientHeight || body.clientHeight ; | |
if (wh<=breakpoint_1){ | |
$('html').addClass('smallscreen'); | |
}else{ | |
$('html').removeClass('smallscreen'); | |
}; | |
$('.popup').css('margin-left', $('.popup').width() / -2); | |
} | |
$(document).ready(function() { | |
if ($('.popup').length) { | |
checkHeight(); | |
$('body').prepend('<div class="overlay HiddenImportant"></div>'); | |
$('html').click(function() { | |
$('.popup,.overlay').addClass('HiddenImportant'); | |
}); | |
$('.popup, .table,.dscr h2 span').click(function(event) { | |
event.stopPropagation(); | |
}); | |
$('.popup').css('margin-left', $('.popup').width() / -2); | |
$('.dscr h2 span').click(function() { | |
$('.overlay,.popup').toggleClass('HiddenImportant'); | |
$('.overlay').css('height', $('#wrapper').height() + 16); | |
}); | |
} else { | |
$('.popup, .table,.dscr h2 span').click(function(event) { | |
event.preventDefault(); | |
}); | |
} | |
$(window).resize(function () { | |
setTimeout( checkHeight(), 1000); | |
}); | |
}); |
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
.popup{ | |
position: absolute; | |
top: 0px; | |
left: 50%; | |
background: #ffffff; | |
box-shadow: 1px 1px 11px #444; | |
z-index: 450; | |
padding: 25px; | |
} | |
.overlay{ | |
position: absolute; | |
background: black; | |
opacity: 0.75; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
z-index: 400; | |
} | |
.popup h2{ | |
text-align: center; | |
} | |
/* | |
@media screen and (width<=1368px){ | |
table.table td, .news_content table td { | |
padding: 3px 5px; | |
} | |
} | |
*/ | |
.smallscreen table.table td, .smallscreen .news_content table td { | |
padding: 3px 5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment