1
我正在創建一個科爾多瓦混合應用程序。我使用Facebookconnectplugin並在第一次啓動時顯示一個教程。這適用於每個支持的Plattform和版本(Android/iOS),但不適用於Android 4.1 此處代碼與「Object#has no method'remove'」分開。當我嘗試刪除fadeMe div時,它總是在線路上崩潰。正如所說的作品在其他地方(4.3以上版本的Android/iOS的7+)對象#<HTMLDivElement>沒有方法'刪除'
facebookConnectPlugin.login(["public_profile", "email", "user_friends"],
function (response) {
//check if this is startup then remove overlay
if(document.getElementById("fadeMe")){
document.getElementById("fadeMe").remove();//document.body.removeChild(div);
describeTableView();
}
}
);
CSS:
#fadeMe{
background-color: rgba(0,0,0,.75);
width: 100%;
height: 100%;
z-index: 11;
top: 0;
left: 0;
position: fixed;
color: #ffffff;
padding-left: 20px;
padding-top: 20px;
font-size: 0.9em;
font-weight: 300;
webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein 2s; /* Firefox < 16 */
-ms-animation: fadein 2s; /* Internet Explorer */
-o-animation: fadein 2s; /* Opera < 12.1 */
animation: fadein 2s;
}
而且它是這樣產生:
var div = document.createElement("div");
div.setAttribute('class', 'fadeMe');
div.setAttribute('id', 'fadeMe');
document.body.appendChild(div);
發現了類似的問題,但沒有回答:Similar Question
的瀏覽器可能不支持'childNode.remove',考慮[填充工具](https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill )。 – MinusFour
是的,我在onDeviceReady中複製了這個,第一次看這個固定它!謝謝! –