window load inside a document ready?

前端 未结 4 1935
盖世英雄少女心
盖世英雄少女心 2020-12-13 05:03

Sorry if this has been answered before but all searches talk about the differences, not about using the two together, if possible.

Simply, can $(window).load.(

4条回答
  •  旧时难觅i
    2020-12-13 05:55

    This works fine and is an acceptable practice. After all, as you describe, there may be cases where the logic in the $(window).load() handler depends on work taking place after the DOM is ready. If the window is in fact already loaded by the time you set up $(window).load(), the handler will just fire immediately.

提交回复
热议问题