Is there any trick how to start a function in javascript, which starts when the page is completely loaded?
If you mean when the HTML document has loaded, use the ready
event:
$(document).ready(function(){
...
});
Or the shorthand:
$(function(){
...
});
If you mean when the page including all style sheets, scripts, images and whatnot has completed loading, use the load
event:
$(window).load(function(){
...
});