0

これにより、テキストファイルからテキストが取得されて表示され、5秒ごとに更新されます。画面アナウンスバナースタイルをスクロールしてテキストを表示したいのですが。マーキーは単なるプレースホルダーですが、これを行うにはどうすればよいですか?

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Raffle Winers</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.marquee.js"></script>
<style type="text/css">
            body {
          margin: 10px;
          font-family: 'Lato', sans-serif;
        }
        small {
            font-size: 14px;
        }
        h1 {
            margin-bottom: 20px;
            padding-bottom: 10px;
            text-align: center;
        }

        h2 {
            border-bottom: 1px dotted #ccc;
            padding-bottom: 5px;
            margin-bottom: 10px;
        }

        .marquee, .marquee-with-options {
          width: 300px;
          overflow: hidden;
          border:1px solid #ccc;
        }
    </style>
    <script>
        $(function(){
            var $mwo = $('.marquee-with-options');
            $('.marquee').marquee();
            $('.marquee-with-options').marquee({
                //speed in milliseconds of the marquee
                speed: 5000,
                //gap in pixels between the tickers
                gap: 50,
                //gap in pixels between the tickers
                delayBeforeStart: 0,
                //'left' or 'right'
                direction: 'left',
                //true or false - should the marquee be duplicated to show an effect of continues flow
                duplicated: true,
                //on hover pause the marquee - using jQuery plugin https://github.com/tobia/Pause
                pauseOnHover: true
            });

            //pause and resume links
            $('.pause').click(function(e){
                e.preventDefault();
                $mwo.trigger('pause');
            });
            $('.resume').click(function(e){
                e.preventDefault();
                $mwo.trigger('resume');
            });
            //toggle
            $('.toggle').hover(function(e){
                $mwo.trigger('pause');
            },function(){
                $mwo.trigger('resume');
            })
            .click(function(e){
                e.preventDefault();
            })
        });
    </script>

</head>
<body>

<script type="text/javascript">
        setInterval(read,100);
    function read(){
    jQuery.get('rafflewinners.txt',function(data){$('#container').html(data);});
}
</script>

<div id="container"></div>


<div id="container" data-speed="2000" data-gap="30" data-direction="right" class='marquee'>#container</div>

</body>
4

1 に答える 1

2

初期化後にDIVの内容が変更されると、マーキープラグインは機能しなくなります。もう一度開始する必要があります。

function read(){
    jQuery.get('rafflewinners.txt',function(data){
        $('#container').html(data).marquee();
    });
}

このフィドルを見る

于 2013-03-07T06:12:32.730 に答える