Salve a tutti,
mi sto cimentando nel provare a far funzionare jquery in modo asincrono, seguendo questa guida seoblog.giorgiotave.it/caricamento-asincrono-jquery/3798 ma con scarsi risultati: la slide non ne vuole sapere di andare.
Così funziona:
codice:
<script type="text/javascript" src="js/jquery.min.js"></script>
<script async src="js/jquery.cycle.all.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.slideshow').cycle({
fx: 'blindZ',
});
});
</script>
E così no:
codice:
<script type="text/javascript">
var jQl={q:[],dq:[],dMap:[],dLoaded:0,gs:[],ready:function(e){if(typeof e=="function"){jQl.q.push(e)}return jQl},getScript:function(e,t){jQl.gs.push([e,t])},unq:function(){for(var e=0;e<jQl.q.length;e++)jQl.q[e]();jQl.q=[]},ungs:function(){for(var e=0;e<jQl.gs.length;e++)jQuery.getScript(jQl.gs[e][0],jQl.gs[e][1]);jQl.gs=[]},bId:null,boot:function(e){if(typeof window.jQuery.fn=="undefined"){if(!jQl.bId){jQl.bId=setInterval(function(){jQl.boot(e)},25)}return}if(!window.jQuery.isReady){return;}if(jQl.bId){clearInterval(jQl.bId)}jQl.bId=0;jQl.testFinished();jQl.ungs();jQuery(jQl.unq());if(typeof e=="function")e()},booted:function(){return jQl.bId===0},testFinished:function(){if(typeof window.jQuery.fn=="undefined"){setTimeout(jQl.testFinished,10);return}if(jQl.dLoaded!=jQl.dMap.length){setTimeout(jQl.testFinished,10);return}jQl.unqjQdep(true);$(jQl.unq())},loadjQ:function(e,t){setTimeout(function(){var t=document.createElement("script");t.src=e;document.getElementsByTagName("head")[0].appendChild(t)},1);jQl.boot(t)},loadjQdep:function(e){jQl.dMap.push(e);jQl.loadxhr(e,jQl.qdep);jQl.dCount++},qdep:function(e,t){if(e){jQl.dLoaded++;jQl.dq[t]=e}},unqjQdep:function(e){if(typeof e!="undefined"&&typeof window.jQuery.fn=="undefined"){setTimeout(jQl.unqjQdep,50);return}for(var t=0;t<jQl.dMap.length;t++)jQl.rs(jQl.dq[jQl.dMap[t]]);jQl.dq=[];jQl.dMap=[]},rs:function(e,t){var n=document.createElement("script");document.getElementsByTagName("head")[0].appendChild(n);n.text=e},loadxhr:function(e,t){var n;n=jQl.getxo();n.onreadystatechange=function(){if(n.readyState!=4||200!=n.status)return;t(n.responseText,e)};try{n.open("GET",e,true);n.send("")}catch(r){}},getxo:function(){var e=false;try{e=new XMLHttpRequest}catch(t){var n=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(var r=0;r<n.length;++r){try{e=new ActiveXObject(n[r])}catch(t){continue}break}}finally{return e}},pageIsLoaded:false,setIsLoaded:function(){jQl.pageIsLoaded=true;}};if(typeof window.jQuery=="undefined"){var $=jQl.ready,jQuery=$;$.getScript=jQl.getScript};if (window.attachEvent){window.attachEvent('onload',jQl.setIsLoaded);}else if(window.addEventListener){window.addEventListener('load',jQl.setIsLoaded,false);}else{document.addEventListener('load',jQl.setIsLoaded,false);}
jQl.loadjQ('//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
jQl.loadjQdep('js/jquery.cycle.all.js');
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".slideshow").cycle({
fx: 'blindZ',
});
});
</script>
L'esempio non funzionante è visibile su coursesenligne.eu
Qualcuno riesce a capire perchè non vada?
Un grazie anticipato per ogni eventuale consiglio