2012-10-29 4 views
1

나는 내 사이트의 상단에 스크롤 짹짹 바를 통합하려고하고 있으며, 지금까지 동일한 자료를 따르는 것처럼 보이는 여러 가지 자습서를 따라 왔지만 작동시키지 못했습니다. 어떻게됩니까가로 스크롤 짹짹

는 설비가 표시되지만 누군가가 올바른 방향으로하시기 바랍니다에 찔러을 제공 할 수있다 "로드"나는 모든 코드를 잘 설정되어 있다고 생각하지만, 내가 뭔가를 누락 될 수 있습니다 말한다입니까?

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script> 
    <script src='js/jquery.marquee.js'></script> 
    <script type='text/javascript'> 
     //<![CDATA[ 
    var Twitter = { 
    init: function() { 
    // Pass in the username you want to display feeds for 
    this.insertLatestTweets('GumBumRadio'); 
    }, 

    // This replaces the <p>Loading...</p> with the tweets 
    insertLatestTweets: function (username) { 
    var limit = 5; // How many feeds do you want? 
    var url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=GumBumRadio' + username + '&count=' + limit + '&callback=?'; 

    // Now ajax in the feeds from twitter.com 
    $.getJSON(url, function (data) { 
     // We'll start by creating a normal marquee-element for the tweets 
     var html = '<marquee behavior="scroll" scrollamount="1" direction="left">'; 

     // Loop through all the tweets and create a link for each 
     for (var i in data) { 
     html += '<a href="http://twitter.com/' + username + '#status_' + data[i].id_str + '">' + data[i].text + ' <i>' + Twitter.daysAgo(data[i].created_at) + '</i></a>'; 
     } 

     html += '</marquee>'; 

     // Now replace the <p> with our <marquee>-element 
     $('#twitter p').replaceWith(html); 

     // The marquee element looks quite shite so we'll use Remy Sharp's plug-in to replace it with a smooth one 
     Twitter.fancyMarquee(); 
    }); 
    }, 

    // Replaces the marquee-element with a fancy one 
    fancyMarquee: function() { 
    // Replace the marquee and do some fancy stuff (taken from remy sharp's website) 
    $('#twitter marquee').marquee('pointer') 
     .mouseover(function() { 
     $(this).trigger('stop'); 
     }) 
     .mouseout(function() { 
     $(this).trigger('start'); 
     }) 
     .mousemove(function (event) { 
     if ($(this).data('drag') == true) { 
     this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX); 
     } 
     }) 
     .mousedown(function (event) { 
     $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft); 
     }) 
     .mouseup(function() { 
     $(this).data('drag', false); 
     }); 
    }, 

    // Takes a date and return the number of days it's been since said date 
    daysAgo: function (date) { 
    // TODO: Fix date for IE... 
    if ($.browser.msie) { 
     return '1 day ago'; 
    } 

    var d = new Date(date).getTime(); 
    var n = new Date().getTime(); 

    var numDays = Math.round(Math.abs(n - d)/(1000 * 60 * 60 * 24)); 
    var daysAgo = numDays + ' days ago'; 

    if (numDays == 0) { 
     daysAgo = 'today'; 
    } 
    else if (numDays == 2) { 
     daysAgo = numDays + ' day ago'; 
    } 

    return daysAgo; 
    } 
    }; 

    Twitter.init(); 
    //]]> 
    </script> 
+0

는 특정 오류 메시지에 대한 귀하의 브라우저 콘솔 창에서 보라. – DaveHogan

+0

많은 감사합니다, 그리고 볼 것입니다 – Ben

+0

아니, 아니 오류, 여기 링크입니다, 당신은 어떻게 볼 수있는 그걸 아무것도 안하고있어 .http : //www.bella-web.co.uk/GumBumRadio2013/index.html – Ben

답변

0

생성 된 트위터 링크에 문제가있는 것 같습니다 : :)

여기 피드의 헤더 코드입니다. 내 브라우저에서 그것을 요구하고 :

그것은이다 :

jquery16106500070334877819_1351522993556({"errors":[{"message":"Sorry, that page does not exist","code":34}]}); 

편집을 반환

http://api.twitter.com/1/statuses/user_timeline.json?screen_name=?GumBumRadio&count=5&callback=jQuery16106500070334877819_1351522993556&_=1351522993562

하는? screen_name 변수에 표시하십시오. 또한 URL 링크에 하드 코딩 된 변수에 사용자 이름 GumBumRadio을 포함시킵니다.

+0

그 이상한, ive 그냥 URL을 확인하고 내 트위터 계정을 다시 당긴다 - 크롬을 사용하여 메신저 : //api.twitter.com/1/statuses/user_timeline.json? screen_name = GumBumRadio – Ben

+0

브라우저에서 어떤 네트워크 연결을 모니터링하는지 되고있다. 그러면 문제가 나타납니다. Chrome/Internet Explorer에서 F12 키를 눌러 개발자 도구를 실행하고 '네트워크'아래를 살펴보세요. 그런 다음 페이지를 새로 고칩니다. – DaveHogan

+0

좋아요, 필자는 Twitter 계정에 접속하는 URL 링크를 변경했으나 아직 운이 없다면 지금 F12에 수표를 줄 것입니다. :) – Ben