Jump to content
php.lv forumi

Recommended Posts

Posted

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

  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted


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;

});

Posted

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.

Posted

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);
		}		
	});
});	

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...