Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Efecto scroll con noticias de cuenta twitter

Estas en el tema de Efecto scroll con noticias de cuenta twitter en el foro de Frameworks JS en Foros del Web. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Javascript : Ver original var Twitter = {     init : function ( ) {     document. getElementById ( "twitter" ...
  #1 (permalink)  
Antiguo 28/09/2011, 16:58
Avatar de ColdFusion  
Fecha de Ingreso: octubre-2008
Ubicación: Tocoa, Colon Honduras C.A.
Mensajes: 419
Antigüedad: 15 años, 6 meses
Puntos: 9
Pregunta Efecto scroll con noticias de cuenta twitter

Código Javascript:
Ver original
  1. var Twitter = {
  2.     init:function(){
  3.     document.getElementById("twitter")&&this.insertarTweets('edwinmunguia')&&this.scroller.init()},
  4.    insertarTweets: function (usuario) {
  5.  
  6.    var limite   = 5;
  7.    var url      = 'http://twitter.com/statuses/user_timeline.json?screen_name=' + usuario + '&count=' + limite + '&callback=?';
  8.     $.getJSON(url, function (datos) {
  9.     var html = '<ul>';
  10.     for (var i in datos) {
  11.     html += '<li><p>' + datos[i].text + '</p></li>';
  12.     }
  13.     html += '</ul>';
  14.     $('#twitter div.balloon').html(html);
  15.     });
  16.    
  17.     },
  18.    
  19.     scroller:{
  20.     init:function(){
  21.     var k=this;this.element=$("#twitter .balloon ul");
  22.     this.width=parseInt(this.element.width(),10);
  23.     this.children=$("li",this.element);
  24.     this.current=0;if($("li:first",this.element).html()!==null){
  25.         setTimeout(function(){k.swap()},2E4);
  26.         setTimeout(function(){k.scroll($("li:first",k.element))},5E3)}},
  27.        
  28.     scroll:function(k){
  29.         k=k.children("p");
  30.         var o=k.width();
  31.         o>this.width&&k.css({left:0}).stop(true,
  32. true).animate({left:this.width-o-10},7500,"linear")},
  33.    
  34.     swap:function(){
  35.         var k=this,o=(this.current+1)%5,x=this.children.eq(o);
  36.         this.children.eq(this.current).stop(true,true).fadeOut(300);
  37.         setTimeout(function(){x.stop(true,true).fadeIn(400)},400);
  38.         x.children("p").css({left:0});
  39.         setTimeout(function(){k.scroll(x)},4E3);
  40.         this.current=o;setTimeout(function(){k.swap()},2E4)
  41.         }
  42.         }};
  43.  
  44. Twitter.init();

En si lo que el script deberia hacer es obtener los ultimos tweets de la cuenta, agregarlos en una div y comienzar el scroll..

Solo funciona si los datos en la div ya fueron establecidos, si los datos son cargados desde twitter no funciona el scroll..

deberia funcionar como esta pagina http://www.spotify.com/int/

alguna ayuda!

Etiquetas: efecto, funcion, html, js, scroll, twitter
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:46.