views:

214

answers:

1

I'd like to create a jQuery function that accepts an image url, and when executed, displays the image full screen matching the height and width of the current page.

Thanks.

+5  A: 

.css({height:'100%',width:'100%', position:'fixed', top:0, left:0});

You can use animation too.

.animate({height:'100%',width:'100%', position:'absolute', top:0, left:0});

Look here for reference.

Mendy
the outer {} should be (), but otherwise correct.
Mike Sherov
IE6 doesn't support `fixed` positioning. `absolute` might be enough, though.
Brian McKenna
hi mendy, i am new to JQuery and i also need to implement same functionality... can you please provide syntax to use animation??
Radhi
@Mike thanks. @Brian true. @Radhi sure.
Mendy
Hi -- When I do this, I still see the scroll bars from the page that is underneath the image. How can I remove them, and then re-apply them when the image come back ? Thanks.
ensnare
You can use Overflow:'hidden' in the body tag.
Mendy
Thanks! Any way to get the height/width to stay in proportion? Right now it's stretching the image.
ensnare