$ (window) .load () works differently on IE and FF

I worked with $(window).load()... and found one question. In fact, in accordance with this function, the first window should be loaded, and then any implementation under this function should begin. This works fine for IE, but not for FF. in ff works like$(document).ready()

can anyone suggest some alternative approach or reason why FF behaves like this.

+3
source share
2 answers

The second method is the preferred method that works for both FF and IE:

$(document).ready(function(){ /*.code.*/ });

Or short form:

$(function(){ /*.code.*/ });
+6
source

To add an answer to Jonathans, jQuery has its own documentation regarding $ (document) .ready:

" JavaScript ,    , , ,   . script , DOM    . , .ready(),   DOM , , ,    jQuery. , CSS   ,    .

: http://api.jquery.com/ready/

EDIT:

, javascript, script, . :

1) script , , load().

2) , "" , , , script. , jQuery ( ), ( http://plugins.jquery.com/taxonomy/term/1939).

+4

Source: https://habr.com/ru/post/1731021/


All Articles