Commits

christiansalazar committed 17b8314

scroll problem fixed. when chat runs in an iframe it scroll the whole page. using this new method it fix the issue.

Comments (0)

Files changed (1)

 					options.onError('timer_rejected',text);
 				}else{
 					// _posts.chat_id, _posts.identity, _posts.posts
+					var hasPosts=false;
 					jQuery.each(_posts.posts, function(k,post){
 						add(post);
+						hasPosts=true;
 					});	
 					options.onSuccess('timer','');
-					scroll();
+					if(hasPosts==true)
+						scroll();
 				}
 			},
 			error: function(e){
 	}
 
 	var scroll = function(){
-		window.location = '#'+posts.find('.post:last').attr('id');
+		//window.location = '#'+posts.find('.post:last').attr('id');
+		var h=0;
+		posts.find('.post').each(function(k){
+			h += $(this).outerHeight();
+		});
+		posts.scrollTop(h);
 	}
 
 	//