w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Want to Disable transparent div at the time of page loading & show after page load

Java Script is only way i believe. Simply You add another class to element when document is ready (dom has fully loaded). This class will make element visible. Visibility instead of display is used to make element take its space event before it's shown.

here's fiddle: http://jsfiddle.net/22Qh2/

and here's the JS code:

window.onload=function(){
    addClass(document.getElementById('transdiv'),'shown');
};

/*  functions handling classes in js */
function hasClass(el, name) {
   return new RegExp('(\s|^)'+name+'(\s|$)').test(el.className);
}
function addClass(el, name){
   if (!hasClass(el, name)) { el.className += (el.className ? ' ' : '')
+name; }
}
function removeClass(el, name){
   if (hasClass(el, name)) {
       el.className=el.className.replace(new
RegExp('(\s|^)'+name+'(\s|$)'),' ').replace(/^s+|s+$/g, '');
   }
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.