Tweetie插件不能在localhost中工作

时间:2015-04-22 04:56:38

标签: php jquery localhost twitter-oauth wampserver

我使用Tweetie插件Link。 上传网站时效果很好,但在我的localhost中不起作用。 我在Windows 8.1上使用wamp服务器

<div class="twitter-feeds">
    <div class="tweet"></div>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="tweetie.js"></script>

<script class="source" type="text/javascript">
    $('.twitter-feeds .tweet').twittie({
        username: 'NawaraGFX',
        list: 'c-oo-l-e-s-t-nerds-i-know',
        dateFormat: '%b. %d, %Y',
        template: '<strong class="date">{{date}}</strong> - {{screen_name}} {{tweet}}',
        count: 1
    }, function () {
        setInterval(function() {
            var item = $('.twitter-feeds .tweet ul').find('li:first');

            item.animate( {marginLeft: '-220px', 'opacity': '0'}, 500, function() {
                $(this).detach().appendTo('.twitter-feeds .tweet ul').removeAttr('style');
            });
        }, 5000);
    });
</script>

2 个答案:

答案 0 :(得分:0)

$(document).ready(function(){ ..... });之后使用您的代码:

<script class="source" type="text/javascript">
$(document).ready( function() {

    $('.twitter-feeds .tweet').twittie({
        username: 'NawaraGFX',
        list: 'c-oo-l-e-s-t-nerds-i-know',
        dateFormat: '%b. %d, %Y',
        template: '<strong class="date">{{date}}</strong> - {{screen_name}} {{tweet}}',
        count: 1
    }, function () {
        setInterval(function() {
            var item = $('.twitter-feeds .tweet ul').find('li:first');

            item.animate( {marginLeft: '-220px', 'opacity': '0'}, 500, function() {
                $(this).detach().appendTo('.twitter-feeds .tweet ul').removeAttr('style');
            });
        }, 5000);
    });

});
</script>

还使用开发人员工具(chrome)或firebug(firefox扩展)并检查控制台选项卡以检查错误。

答案 1 :(得分:0)

我认为问题出在 localhost 这个域上 我也用twitter和facebook插件来解决这个问题

所以这里唯一的解决方案是更改您的主机文件

  

C:\ Windows \ System32下\驱动程序\等\

this video may help