jquery asynchroon laden
http://idiallo.com/javascript/async-jquery
maar ik krijg nog foutmeldingen dat jquery niet geladen is als dit:
Dus in mijn footer heb ik
Waarom werkt dit niet?
Ik heb deze code uitgeprobeerd: maar ik krijg nog foutmeldingen dat jquery niet geladen is als dit:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2017-04-05 09:59:14.198 jquery.validate.min.js:4 Uncaught ReferenceError: jQuery is not defined
at jquery.validate.min.js:4
at jquery.validate.min.js:4
(anonymous) @ jquery.validate.min.js:4
(anonymous) @ jquery.validate.min.js:4
2017-04-05 09:59:14.202 jquery.mmenu.min.all.js:13 Uncaught ReferenceError: jQuery is not defined
at jquery.mmenu.min.all.js:13
(anonymous) @ jquery.mmenu.min.all.js:13
2017-04-05 09:59:14.204 unslider-min.js:1 Unslider needs jQuery
(anonymous) @ unslider-min.js:1
(anonymous) @ unslider-min.js:1
2017-04-05 09:59:14.226 jquery-ui.min.js:5 Uncaught ReferenceError: jQuery is not defined
at jquery-ui.min.js:5
(anonymous) @ jquery-ui.min.js:5
2017-04-05 09:59:14.228 tooltipsy.min.js:20 Uncaught ReferenceError: jQuery is not defined
at tooltipsy.min.js:20
(anonymous) @ tooltipsy.min.js:20
2017-04-05 09:59:14.288 (index):7580 jquery main script is ready
at jquery.validate.min.js:4
at jquery.validate.min.js:4
(anonymous) @ jquery.validate.min.js:4
(anonymous) @ jquery.validate.min.js:4
2017-04-05 09:59:14.202 jquery.mmenu.min.all.js:13 Uncaught ReferenceError: jQuery is not defined
at jquery.mmenu.min.all.js:13
(anonymous) @ jquery.mmenu.min.all.js:13
2017-04-05 09:59:14.204 unslider-min.js:1 Unslider needs jQuery
(anonymous) @ unslider-min.js:1
(anonymous) @ unslider-min.js:1
2017-04-05 09:59:14.226 jquery-ui.min.js:5 Uncaught ReferenceError: jQuery is not defined
at jquery-ui.min.js:5
(anonymous) @ jquery-ui.min.js:5
2017-04-05 09:59:14.228 tooltipsy.min.js:20 Uncaught ReferenceError: jQuery is not defined
at tooltipsy.min.js:20
(anonymous) @ tooltipsy.min.js:20
2017-04-05 09:59:14.288 (index):7580 jquery main script is ready
Dus in mijn footer heb ik
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script>
var async = async || [];
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = '<?=HTML_ROOT?>js/jquery-1.12.4.min.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
$(obj[1]);
}else if (obj[0] =="load"){
$(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
$(param[1]);
}else if (param[0] =="load"){
$(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
</script>
<?php
require_once(DOC_ROOT.'js/headerjs.php');
?>
<script defer async src="<?=HTML_ROOT?>js/jquery-ui.js"></script>
<script defer async type="text/javascript" src="<?=HTML_ROOT?>js/jquery.validate.min.js"></script>
<script defer async type="text/javascript" src="<?=HTML_ROOT?>js/jquery.mmenu.min.all.js"> </script>
<script defer async src="<?=HTML_ROOT?>js/unslider-min.js" type="text/javascript"></script>
<script defer async src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script defer async src='<?=HTML_ROOT?>js/tooltipsy.min.js'></script>
<script defer async src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
<script async src="<?=HTML_ROOT?>js/script.js" defer></script>
<script async src="<?=HTML_ROOT?>js/markerclusterer.js" defer></script>
var async = async || [];
(function () {
var done = false;
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0] || document.documentElement;
script.src = '<?=HTML_ROOT?>js/jquery-1.12.4.min.js';
script.type = 'text/javascript';
script.async = true;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
done = true;
console.log('jquery main script is ready');
// Process async variable
//var async = async || [];
while(async.length) { // there is some syncing to be done
var obj = async.shift();
if (obj[0] =="ready") {
$(obj[1]);
}else if (obj[0] =="load"){
$(window).load(obj[1]);
}
}
async = {
push: function(param){
if (param[0] =="ready") {
$(param[1]);
}else if (param[0] =="load"){
$(window).load(param[1]);
}
}
};
// End of processing
script.onload = script.onreadystatechange = null;
if (head && script.parentNode) {
head.removeChild(script);
}
}
};
head.insertBefore(script, head.firstChild);
})();
</script>
<?php
require_once(DOC_ROOT.'js/headerjs.php');
?>
<script defer async src="<?=HTML_ROOT?>js/jquery-ui.js"></script>
<script defer async type="text/javascript" src="<?=HTML_ROOT?>js/jquery.validate.min.js"></script>
<script defer async type="text/javascript" src="<?=HTML_ROOT?>js/jquery.mmenu.min.all.js"> </script>
<script defer async src="<?=HTML_ROOT?>js/unslider-min.js" type="text/javascript"></script>
<script defer async src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script defer async src='<?=HTML_ROOT?>js/tooltipsy.min.js'></script>
<script defer async src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
<script async src="<?=HTML_ROOT?>js/script.js" defer></script>
<script async src="<?=HTML_ROOT?>js/markerclusterer.js" defer></script>
Waarom werkt dit niet?
Er zijn nog geen reacties op dit bericht.