JavaScript Loading Screen while page loads

You can wait until the body is ready:  Run code snippetExpand snippet Here is a JSFiddle that demonstrates this technique. Update Here is a modern version using promises. The promise is completely optional now, as it is only used for a delay. The DOMContentLoaded event will fire once the page is loaded.

PHP – how to create a newline character?

Only double quoted strings interpret the escape sequences \r and \n as ‘0x0D’ and ‘0x0A’ respectively, so you want: Single quoted strings, on the other hand, only know the escape sequences \\ and \’. So unless you concatenate the single quoted string with a line break generated elsewhere (e. g., using double quoted string “\r\n” or using chr function chr(0x0D).chr(0x0A)), the only other way to have a line break …

Read more

jQuery: How can I create a simple overlay?

An overlay is, simply put, a div that stays fixed on the screen (no matter if you scroll) and has some sort of opacity. This will be your CSS for cross browser opacity of 0.5: This will be your jQuery code (no UI needed). You’re just going to create a new element with the ID #overlay. Creating and destroying the …

Read more

What is the significance of the number, 32767?

32767 + 1 is a power of 2 Binary representation of numbers uses powers of 2. So, in an 4-bit structure, 0101 is 2^0 x 1, 2^1 x 0, 2^2 x 1, and 2^3 x 0 which is 5. The MSB is used for sign and unsigned integers.

wait() or sleep() function in jquery?

setTimeout will execute some code after a delay of some period of time (measured in milliseconds). However, an important note: because of the nature of javascript, the rest of the code continues to run after the timer is setup: