Full screen a div using simple javascript

Here I am explan about expand(full screen) a particular div, here I'm taking 'divfullscreen' div, when click on Demo button call ExpandDiv javascript function, this function handle full screen.

JAVASCRIPT CODE :

function ExpandDiv(){
var elem = document.getElementById('divfullscreen');
                    if (document.webkitFullscreenElement) {
                        document.webkitCancelFullScreen();
                    }
                    else {
                        elem.webkitRequestFullScreen();
                    };
}

HTML CODE :

<div>
<input onclick="ExpandDiv();" type="button" value="Demo" /></div>
<div class="html5-fullscreen-api" id="divfullscreen">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQCdYtF3j7DxNl2SlnCtiMPbgyGuhuQ5sULJKoCi1-fzH6RpObABg" />
</div>
</div>

Comments

Post a Comment

Popular posts from this blog

Setup and implement simple angular.js program in MVC

Cross browsers detect print events using javascript

HTML5 drag and drop