2012-10-29 50 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

不,沒有錯誤,這裏是鏈接,你可以看到它只是沒有做anything.http://www.bella-web.co.uk/GumBumRadio/GumBumRadio2013/index.html – Ben

回答

0

有似乎有點問題產生的Twitter鏈接。在我的瀏覽器,它正在請求:

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

返回

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

編輯:

它的?在screen_name變量中標記。您還將用戶名GumBumRadio包含在變量中,該變量也在URL鏈接中進行了硬編碼。

+0

這就是奇怪,我剛檢查URL,並將其拉回到我的Twitter賬戶 - 使用Chrome.http IM://api.twitter.com/1/statuses/user_timeline.json SCREEN_NAME = GumBumRadio – Ben

+0

在瀏覽器監視哪些網絡連接正在製造。那麼你會看到這個問題。只需在Chrome/IE中按F12即可調出開發工具並在「網絡」下查找。然後刷新頁面 – DaveHogan

+0

好吧,看看,ive將url鏈接更改爲點擊Twitter帳戶的鏈接,但仍然沒有運氣,我現在會給F12一張支票。 :) – Ben