Skip to content

Commit

Permalink
More fixes for resizing the popovers.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 6, 2010
1 parent 077c1f5 commit 860c4c2
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions index.html
Expand Up @@ -26,13 +26,32 @@
$(current_popover).fadeOut("slow");

current_popover = element;
ui_resize(); // make this sane.

$("#backgroundpopover").css('opacity', '0.7');
$("#backgroundpopover").fadeIn('slow');
$(element).fadeIn('slow');

// I guess this doesn't actually recalculate the element sizes until the
// scripts are idle, so do a short timeout so it rechecks this after
// the layout has a chance to catchup.
setTimeout('ui_resize();', 10);
} // popover

function ui_resize()
{
var element = current_popover;
if (element == null)
return;

$('#backgroundpopover').css('height', windowHeight);

var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupWidth = windowWidth / 2;
$(element).css('width', popupWidth);

var popupHeight = $(element).height();
var popupHeight = $(element).children().height();

$(element).css({
position: 'absolute',
Expand All @@ -41,12 +60,7 @@
width: popupWidth,
height: popupHeight,
});

$('#backgroundpopover').css('height', windowHeight);
$("#backgroundpopover").css('opacity', '0.7');
$("#backgroundpopover").fadeIn('slow');
$(element).fadeIn('slow');
} // popover
} // ui_resize

function render()
{
Expand Down Expand Up @@ -404,6 +418,11 @@

// kick off AJAX load of user profile when document is ready for action.
$(document).ready(function(){
$(window).resize( function() { ui_resize(); } );

// Mobile Safari (etc?) orientation support.
window.onorientationchange = function() { ui_resize(); }

popover('#loadingmessage');
$.ajax({
type: "GET",
Expand Down

0 comments on commit 860c4c2

Please sign in to comment.