Hi Guys,
Ok to start with this solution will not work on Internet Explorer and will work perfectly on Chrome or webkit based browsers like Firefox. One more reason to ditch that browser
So recently Facebook made a change where you can view your photo in Full Screen. So how to switch your browser screen to full screen mode.
We will be looking at
- Just by clicking a Link how to switch to full screen mode
- How to make an Element full screen.
Just by clicking a Link how to switch to full screen mode
Ok so try this code below
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>jaspreetchahal.org</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> </head> <body > <a href="javascript:void(0)" id="fullscreen">full screen</a> <script> $("#fullscreen").bind("click", function() { var elem = document.documentElement, req = elem.requestFullScreen || elem.webkitRequestFullScreen || elem.mozRequestFullScreen ; req.call(elem); }); // Above can be re-written as /* $("#fullscreen").bind("click", function() { var elem = document.documentElement, if (elem.requestFullScreen) { elem.requestFullScreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullScreen) { elem.webkitRequestFullScreen(); } }); */ </script> </body> </html>
Above code will work on full document and make it Full screen.
So in the above code we are grabbing an Element and applying requestFullScreen* method to that element.
Now lets see How to make an Image full screen.
There is not much change in the logic, http://jaspreetchahal.org/wp-content/uploads/2012/04/gold_wheat.jpg
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>jaspreetchahal.org</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> </head> <body > <a href="javascript:void(0)" id="fullscreen">full screen</a> <script> $("#fullscreen").bind("click", function() { var elem = document.getElementById("img"), req = elem.requestFullScreen || elem.webkitRequestFullScreen || elem.mozRequestFullScreen ; req.call(elem); }); </script> <img src="/path/to/your/img" id="img" /> </body> </html>
As you see that we are trying to make an image Full screen here. our elem variable is a reference to “img” which is an ID for the Image we want to make full screen.
If you are using Chrome or FF try click the link below

Images like above can be downloaded from iStockPhoto. Join now





JC WordPress Coupon Revealer Plugin Pro License
Australian Street Names with City, State and Display Names only, Single Server License
Twitter: DariusBlade
says:
function enterFullScreen(){
var bro = navigator.appName;
var elem = document.getElementById(“video”);
// IE/Opera
if(bro == “Microsoft Internet Explorer” || bro == “Opera”)
{
elem.style.width = ’100%’;
elem.style.height = ’100%’;
elem.style.position = ‘absolute’;
elem.style.left = ’0px’;
elem.style.top = ’0px’;
}
if (bro != “Microsoft Internet Explorer”)
{
if(elem.requestFullScreen) {
elem.requestFullScreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
}
}
welcome
Twitter: DariusBlade
says:
Solution for IE 9:
function enterFullScreen(){
var elem = document.getElementById(“video”);
//for IE
elem.style.width = ’100%’;
elem.style.height = ’100%’;
elem.style.position = ‘absolute’;
elem.style.left = ’0px’;
elem.style.top = ’0px’;
//show full screen
if (elem.requestFullScreen) {
elem.requestFullScreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
Thanks Darius, much appreciated.
Cheers!
Twitter: DariusBlade
says:
doesn’t work on IE
great blog
Thanks kuldeep
Cheers!
Jaspreet Chahal recently posted..WordPress Change title from plugin based on post or page ID