flexiquote旋转器定制调整

时间:2013-06-27 18:57:32

标签: php javascript jquery

我正在使用flexiquoterotator进行单词操作我调整它以显示下一个和上一个按钮以下是我的代码

function ($) {
    var callquote;
    quoteRotator = {
    i: 1,
quotes: [";

    $i=0;

    foreach($results as $result){

    echo "\"$openquote<span id='quote'>$result->quote</span>$closequote";

    if($result->author != '')

echo " <span id='quoteauthor'>$result->author</span>";

    echo "\",\n";
        $i++;

        }

],

        numQuotes: ".$i.",

    fadeDuration: ".$fade.",
                    fadeoutDuration: ".$fadeout.",

                    delay: ".$delay.",

                    quotesInit: function(){

                        if (this.numQuotes < 1){

                            document.getElementById('quoterotator').innerHTML=\"No Quotes Found\";

                        } else {
                            this.navQuote();
                            this.quoteRotate();
                            this.quotehover();
                        }
                    },
                    navQuote: function() {
                        $('<div id=\"quotenav\"></div>').insertAfter('#quotearea');
                        for (n=1; n <= this.numQuotes ; n++) {

        }

$('#quotenav').append('<span onclick=\"quoteRotator.callQuote(this,'+n+')\">Next</span>');

for (k= -3; k <= this.numQuotes ; k++) {

        }

                        $('#quotenav').append('<span id=\"test\" onclick=\"quoteRotator.callQuote(this,'+k+')\">Prev</span>');


                        // insert style
                        $('head').append('<style type=\"text/css\">#quotenav {display: block;text-align: center;font-size: 50px;color: #000;}#quotenav span {margin: 0 3px;cursor: pointer;}#quotenav span.active,#quotenav span:hover{color: red;}</style>');
                    },
                    quoteRotate: function(i){
                        if(!i) {
                            i = this.i;
                        }
                        $('#quotenav span').each(function () {
                            $(this).removeClass('active');
                        });
                        $('#quotenav span:nth-child('+i+')').addClass('active');

                        jQuery('#quoterotator').hide().html(this.quotes[i - 1]).fadeIn(this.fadeDuration * 1000).css('filter','');

                        this.i = i % (this.numQuotes) + 1;

                        callquote = setTimeout('quoteRotator.quoteRotate()', (this.delay + this.fadeDuration) * 1000);

                    },
                    callQuote: function(e,n) {
                        clearTimeout(callquote);
                        this.quoteRotate(n);
                    },
                    quotehover: function() {
                        jQuery('#quotearea').mouseenter(function () {
                            clearTimeout(callquote);
                          }).mouseleave(function(){
                                setTimeout('quoteRotator.quoteRotate()', 500);
                          });
                    }
                }
        })(jQuery);

上面的代码没有显示next和prev按钮,而是适用于点阵导航。

1 个答案:

答案 0 :(得分:0)

我改变了按钮的位置并且工作正常。