Here I'm explain about detecting before print, after print in cross browsers using Java script. Window beforeprint,afterprint events working in only IE,Firefox browsers, but we can detect these events using matchMedia with event handler, here I'm explain with small example. Javascript Code: (function () { var beforePrint = function () { alert('Functionality to run before printing.'); }; var afterPrint = function () { alert('Functionality to run after printing'); }; if (window.matchMedia) { var mediaQueryList = window.matchMedia('print'); mediaQueryList.addListener(function (mql) { if (mql.matches) {...
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-...
Comments
Post a Comment