简体   繁体   中英

Which event I have to use in jquery to get called before my page elements load?

I want to use boomrang framework in Jquery to get the bandwidth of the user's network which has to be displayed on the screen as "connection : fair/poor/good".

With on ready,on load, etc.., javascript function will be called only after the elements are ready to be accessed. But, I want the boomrang call to be called quite before that. Please tell me which event I have to use so that function call can happen before the elements of the page loads. Thanks in advance.<>

Note: I have tried by putting script tag at the top of the head tag. But still page elements are getting evaluated first (along with their el expressions).

If you want your function to be called before DOM creation then you dont need to call your function in any onload or on(document).ready, what you have to do is just call your function inside the script tag

For example (Script on the top of the page)

<script>

function abc()
{
// function desc
}

abc(); //Will be called as soon as the url is opened

$(document).ready(function()
{
abc(); // will be called when the DOM is ready
});

</script>

Use bw plugin from boomrang freamework

http://yahoo.github.io/boomerang/doc/howtos/howto-3.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM