0

Facebook の機能をアプリケーションに実装しようとしています。最初の機能は、Facebook を使用してログインできることでした。2 つ目は、ユーザーが Facebook からアプリケーションに友達をインポートできるようにするためのものです。

ただし、問題は、FB API を使用しているときに JQuery Mobile の機能が停止することです。

Facebook API コードを削除すると、レイアウトは完璧に機能します。これは、data-role が controlgroup に設定されたフィールドセットを追加すると、要素とその子に JQuery スタイルと関数が適用されないことを意味します。

この問題の解決策を知っている人はいますか? (ソーシャル API を利用する JQuery Mobile アプリがもっと増えるはずです)。

Controller.js

this.handleContactsFacebook = function () {
        this.initialize();

        function retrieveContacts () {
            FB.api('/me/friends/?fields=id,first_name,middle_name,last_name,username,name', function(response) {
                (new Contact()).showContactListFacebook(response.data);
            });
        }

        FB.getLoginStatus(function (data) {
            if (data.status === 'connected') {
                retrieveContacts();
            }
            else if (data.status === 'not_authorized') {
                $.mobile.changePage("menu.html");
            }
            else {
                $.mobile.changePage("menu.html");
            }
        });
    };

contact.js

this.showContactListFacebook = function (contacts) {
        var fieldset = $("<div data-role=\"fieldcontain\">" +
        "<fieldset data-role=\"controlgroup\">" +
            "<legend>Agree to the terms:</legend>" +
            "<input type=\"checkbox\" name=\"checkbox-1\" id=\"checkbox-1\" class=\"custom\" />" +
            "<label for=\"checkbox-1\">I agree</label>" +
            "</fieldset>" +
        "</div>");
        $("fieldset").remove();
        $("#contactsFacebook").prepend(fieldset);
    };

http://forum.jquery.com/topic/jquery-mobile-ignored-data-role-when-implementing-facebook

4

1 に答える 1