ziedinjsh Posted November 18, 2014 Report Share Posted November 18, 2014 Sveiki! Ir tāda lieta, ka jQuery on() funkcija nostrādā tikai vienu reizi. Doma ir sekojoša uzspiežot uz trigera parādās rezūltāts, viņu var spaidīt daudz un dikti, bet tikai ne uz IE. Interesantākais, ka atverot inspect elements (ko piedāvā IE) tad strādā, līdz ko viņu aizver, nestrādā. Vai kāds zin atbildi? :D Quote Link to comment Share on other sites More sharing options...
jurchiks Posted November 18, 2014 Report Share Posted November 18, 2014 Kodu galdā. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 jQuery('#showAwr').on('click', function(){ jQuery('.form').fadeOut(200,function(){ jQuery.getJSON('process/home.php?w=getawr', function(data) { for (var i in data) { var id = data.aid; var awr = data.answer; var like = data.likes; var dislike = data.dislikes; var answer = '<div class="awrtext">'+awr+'</div>'+ '<div class="option">'+ '<ul id="awrotn">'+ '<li id="'+id+'" class="like btn"><span class="likec">'+like+'</span></li>'+ '<li id="'+id+'" class="dislike btn"><span class="dislikec">'+dislike+'</span></li>'+ '<div class="fix"></div>'+ '</ul>'+ '</div>'; jQuery('.answer').fadeIn(200).html(answer); console.log(answer); jQuery('.similar').hide('slide', { direction: 'right' }, 300, function(){ jQuery('.similar').html(''); }); } }); }); return false; }); Quote Link to comment Share on other sites More sharing options...
jurchiks Posted November 18, 2014 Report Share Posted November 18, 2014 Nu tāāāā... Pirmkārt jau tu ciklē cauri tam data objektam un katrā iterācijā liec HTML saturu vienā un tajā pašā elementā: "jQuery('.answer').fadeIn(200).html(answer)" - btw,šeit prasās secību otrādāk -, kā arī turpat slēp tos ".similar" elementus. Bet eventu šeit nekas neatbaindo. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 (edited) Kur tad ir problēma? :D Un kapēc strādā tikai tad, ja atver Inspect Elements? Edited November 18, 2014 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
jurchiks Posted November 18, 2014 Report Share Posted November 18, 2014 Varbūt tev kaut kur citur kodā unbaindojas šis click events, vai vnk IE nepatīk tas, ka tu ciklā izsauc animāciju un viņš vnk klikšķus ievieto FIFO queue. Quote Link to comment Share on other sites More sharing options...
Kasspars Posted November 18, 2014 Report Share Posted November 18, 2014 Exploderis nogļuko pie console.log, jo kad inspektors aizvērts, tad nav tāda objekta console Quote Link to comment Share on other sites More sharing options...
jurchiks Posted November 18, 2014 Report Share Posted November 18, 2014 (edited) Aii, par šito spoku es jau biju aizmirsis, nekad nedebagoju javaskriptu IE. Edited November 18, 2014 by jurchiks Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 uztaisīju promitīvāku.. tāpat neiet jQuery('#showAwr').on('click', function(){ jQuery.getJSON('process/home.php?w=getawr', function(data) { for (var i in data) { var id = data[i].aid; var awr = data[i].answer; var like = data[i].likes; var dislike = data[i].dislikes; var answer = '<div class="awrtext">'+awr+'</div>'+ '<div class="option">'+ '<ul id="awrotn">'+ '<li id="'+id+'" class="like btn"><span class="likec">'+like+'</span></li>'+ '<li id="'+id+'" class="dislike btn"><span class="dislikec">'+dislike+'</span></li>'+ '<div class="fix"></div>'+ '</ul>'+ '</div>'; jQuery('.answer').html(answer); } }); }); Quote Link to comment Share on other sites More sharing options...
Kasspars Posted November 18, 2014 Report Share Posted November 18, 2014 Par console laikam nebūs man taisnība, uz 11 explorer strādā, tikko pārbaudīju. Bet atmiņā kaut kā stāv šitā problēma Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 vienu reizi tā on() funkcija nostrādā, bet nospiežot atkārtoti nestrādā. Chrome, Firefox, Opera viss ok Quote Link to comment Share on other sites More sharing options...
e-remit Posted November 18, 2014 Report Share Posted November 18, 2014 Pašā JS koda sākumā ieliec console = console || {}; console.log = console.log || function(){}; Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 Neko nedeva Quote Link to comment Share on other sites More sharing options...
briedis Posted November 18, 2014 Report Share Posted November 18, 2014 id atribūtam jābūt UNIKĀLAM! Tev viņi tur dublējās nejēgā. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 18, 2014 Author Report Share Posted November 18, 2014 tad kapēc viņi strādā pārējos browseros, bet nestrādā tikai IE? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.