Alex Rivera | Logout

Make div 'fullscreen' onClick of a button?

Asked 2012-03-08T15:31:59.330
8

I have a div that I want to go full-screen (100% width/height of Window size) onClick of a seperate button, image or link. How would I go about this using Javascript/jQuery?

Edit
Report

1 Answer

0

Here's a tweaked version of my answer from yesterday:

DEMO

$(':button').click(function() {
  $('div > div').css({
      position:'absolute', //or fixed depending on needs
      top: $(window).scrollTop(), // top pos based on scoll pos
      left: 0,
      height: '100%',
      width: '100%'
  });
});
answered 2012-03-08T15:39:45.507

Your Answer