0

FLIPを使おうとしています!プラグインとそのコンテンツをajaxによってロードします。しかし、私は問題に直面しています。動作していません。

ファイアバグで発生しているpostイベントを確認できますが、FLIP内に「content」パラメーターを設定しても何も変わらないようです。プラグイン。

以下は、物事をよりよく説明するかもしれない私のコードです。

<script type="text/javascript">

        function getFlipContent(url,command, target){   
            $.post(url, {"data": command}, function(response) {
                console.log(response);
                //return response;   // this is not working
                replaceHtml(target,response);  // workaround but kinda not really
            });
        }

        function replaceHtml(object,html){
            $(object).html();
            $(object).html(html);
        }

        $(function(){

            $(".flipable2").bind("click", function() {
                var url= $(this).data("url");
                var command= $(this).data("command");
                var target = $(this).data("target");
                //alert(flip);
                if (target === undefined) {
                    flip = "self";
                }
                if (target == "self") {
                    $($(this)).flip({
                        direction: 'lr',
                        color: '#ffffff',
                        content: function() {
                            getFlipContent(url, command, target);
                        }
                    });
                    return false;
                }
                else {
                    $(target).flip({
                        direction: 'lr',
                        color: '#ffffff',
                        content: function() {
                            getFlipContent(url, command, target);
                        }
                    });
                    return false;
                }
            });

        });
</script>


    <body>
    <div id="header">
        <table width="100%" cellpadding="0px" border="0px" cellspacing="0px">
            <tr>
                <td><a href="#" class="flipable2 box" data-target="#page" data-url="test.php" data-command="test">FLIP</a></td>
            </tr>
        </table>
    </div>

    <div id="page" class="box">
        BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH</td>
    </div>

そのため、現在、replachtml関数を使用して、「反転」したばかりのターゲットのコンテンツを手動で書き直しています。このソートは機能しますが、アニメーションが壊れるので、プラグインのコンテンツパラメータを使用したいと思います...それを実行すると、何も実行されません。アニメーションは完了しますが、コンテンツの変更はありません。多分何かが足りないと思います。どんな助けでも大歓迎です。

これもjsfiddleです:http://jsfiddle.net/mUhuN/9/ajaxリクエストを偽造する方法がわかりませんでしたが。

とにかく助けてください:)

4

1 に答える 1

1

アニメーションの前に、コールバックを使用してAjaxをロードしてみてください。

$("#flipbox").flip({
    direction:'tb',
    onBefore: function(){
            console.log('before starting the animation');
    },
    onAnimation: function(){
            console.log('in the middle of the animation');
    },
    onEnd: function(){
            console.log('when the animation has already ended');
    }
})
于 2013-02-20T12:23:03.850 に答える