Javascript before onload?

前端 未结 2 985
一生所求
一生所求 2020-11-30 09:14

Is there any event handler before onLoad/onPageShow? The trouble with onLoad is if there is any change in display, the page will show up without change until it is fully loa

2条回答
  •  盖世英雄少女心
    2020-11-30 09:27

    The simple answer is to place the function call after the DOM element inside script tags, within the body of your page. I had this problem using a javascript function to style my navigation menu links, however I had a google map element that caused the page to load slowly. On this paticular page, I ran the script just after the link. It is a solution, maybe not the best but it works. Hope this helps.

提交回复
热议问题