Skip to content

Instantly share code, notes, and snippets.

@joncooper
Created November 15, 2011 21:56
Show Gist options
  • Select an option

  • Save joncooper/1368508 to your computer and use it in GitHub Desktop.

Select an option

Save joncooper/1368508 to your computer and use it in GitHub Desktop.
chrome-pt-blog-2
<!-- Force a reflow of the page by changing its dimensions. -->
var redraw = function() {
chrome.windows.getLastFocused(function(window) {
var dimensions = {};
dimensions.width = window.width;
dimensions.height = window.height;
dimensions.left = window.left;
dimensions.top = window.top;
dimensions.width--;
chrome.windows.update(window.id, dimensions);
dimensions.width++;
chrome.windows.update(window.id, dimensions);
});
}
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request == 'redraw')
redraw();
});
toggle_header: function() {
$('#header').fadeToggle(function() {
chrome.extension.sendRequest('redraw');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment