2011-11-13 6 views
0

私のウェブサイトで私のTwitterアカウントのマーキーをつくろうとしています。mootoolsのtwitterウィジェットですか?

と私の成功は、それがjQueryのを使用して、ここに私のコードであることを確認します

<div id="twitter"> 
    <p> 
     تحميل.....</p> 
    <noscript> 
     هذه الخدمة بحاجة الى الجافا سكريبت</noscript> 
</div> 
<script language="javascript"> 
    var Twitter = { 
     init: function() { 
      // Pass in the username you want to display feeds for 
      this.insertLatestTweets('@ajialq8'); 
     }, 

     // This replaces the <p>Loading...</p> with the tweets 
     insertLatestTweets: function (username) { 
      var limit = 5; // How many feeds do you want? 
      var url = 'http://twitter.com/statuses/user_timeline.json?screen_name=' + 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="right">'; 

       // 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 == 1) { 
       daysAgo = numDays + ' day ago'; 
      } 

      return daysAgo; 
     } 
    }; 

    Twitter.init(); 
</script> 

が、問題は(jQueryとMooToolsはの間に)私の回転子バナーとマーキーの間の重要な対立があるということです!

私はテーマの両方を使う代わりにMooToolsを使うことにしましたが、上記のコードをmooToolsを使って作業する方法はわかりません!!

誰かが私がそれを感謝するのを助けることができるならば。

答えて

0

あなたは一時的な解決策として、MooToolsのではjQueryを使用することができ、ちょうどjQuery.noConflict()を呼び出し、それがここに記載されているように、既に http://docs.jquery.com/Using_jQuery_with_Other_Libraries#Overriding_the_.24-function

+0

(...)jQueryのにIを を$(...)を交換この1つを試してくださいが、結果はうまくいきません! – HAJJAJ

+0

バグをチェックすればうまくいくはずです。 http://davidwalsh.name/jquery-mootools – shomeax

+0

私は既にバグをチェックしていました。私のウェブサイトに4つのバグがありました。IEは私にバグを示しています。それが私がMooTools Onlyを使う理由です。 今私が必要としているのは、マーキーの中のツイーターにつぶやく方法です。 – HAJJAJ

関連する問題