Skip to content

Instantly share code, notes, and snippets.

@jhouedanou
Created November 18, 2016 10:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhouedanou/b61a4601f298c89cd6a91da828acb824 to your computer and use it in GitHub Desktop.
Save jhouedanou/b61a4601f298c89cd6a91da828acb824 to your computer and use it in GitHub Desktop.
responsive thickbox
(function ($) {
$(window).resize(function() {
var newHeight = $(window).height();
// console.log(newHeight);
var newWidth = $(window).width();
// console.log(newWidth);
$("#TB_window").css("height", (newHeight));
$("#TB_window").css("width", (newWidth));
$('#TB_ajaxContent').css("width", (newWidth));
$("#TB_window").css("margin-left", -(parseInt((newWidth)/2)));
// $("#TB_window").css("margin-left", (-newWidth)/2);
});
/* trigger when page is ready */
$(window).load(function() {
var newHeight = $(window).height();
// console.log(newHeight);
var newWidth = $(window).width();
// console.log(newWidth);
$("#TB_window").css("height", (newHeight));
$("#TB_window").css("width", (newWidth));
$('#TB_ajaxContent').css("width", (newWidth));
$("#TB_window").css("margin-left", -(parseInt((newWidth)/2)));
});
}(window.jQuery || window.$));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment