Firebase是否影响我的Jquery/Semantic UI下拉列表?
我正在从事一个项目,其中有一个语义UI/jQuery下拉列表。我在代码笔和我的电脑上有完全相同的代码。但是,CodePen示例工作,而计算机示例不工作(当我运行firebase Service或部署时) 这两个文件之间的唯一区别是其中一个包含Firebase。Firebase会影响我的项目吗?还是我做错了什么?我用jQuery初始化了下拉列表,将其包含在语义UI中,它在代码笔中工作。我做错了什么?我像这样初始化了我的下拉列表,我知道它可以工作,因为它在CodePen中工作:Firebase是否影响我的Jquery/Semantic UI下拉列表?,jquery,firebase,drop-down-menu,semantic-ui,Jquery,Firebase,Drop Down Menu,Semantic Ui,我正在从事一个项目,其中有一个语义UI/jQuery下拉列表。我在代码笔和我的电脑上有完全相同的代码。但是,CodePen示例工作,而计算机示例不工作(当我运行firebase Service或部署时) 这两个文件之间的唯一区别是其中一个包含Firebase。Firebase会影响我的项目吗?还是我做错了什么?我用jQuery初始化了下拉列表,将其包含在语义UI中,它在代码笔中工作。我做错了什么?我像这样初始化了我的下拉列表,我知道它可以工作,因为它在CodePen中工作: $('.ui.dro
$('.ui.dropdown')
.dropdown({
on: 'hover',
action: 'nothing'
})
;
我已经确认JS和CSS的其他部分可以工作。
指向我的代码笔的链接:
我建议您只查看代码笔,但如果您真的需要代码,请参见:
我的头看起来像这样:
<title>Head</title>
<script src="https://www.gstatic.com/firebasejs/4.6.2/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "[]",
authDomain: "[]",
databaseURL: "[]",
projectId: "[]",
storageBucket: "[]",
messagingSenderId: "[]"
};
firebase.initializeApp(config);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.2.13/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.2.13/dist/semantic.min.js"></script>
<link rel="stylesheet" href="/quotes.css">
<script src="/quotes.js"></script>
忽略额外的CSS,我从HTML中删除了一些内容,但确认它具有相同的行为
JS:
同样,忽略额外的内容(包括#用户名写入)。您可能会发现这个有趣的:[link]()您可能会发现这个有趣的:[link]()
body {
background: #e8ebef;
}
.ui.secondary.pointing.fixed.menu {
border-bottom: 0px solid;
margin-top: 5em;
}
.menu.toxindex, .scrolling.menu, div.ui.floating.dropdown.button {
z-index: 999;
}
var displayName;
var email;
var uid;
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
displayName = user.displayName;
email = user.email;
var emailVerified = user.emailVerified;
var photoURL = user.photoURL;
var isAnonymous = user.isAnonymous;
uid = user.uid;
var providerData = user.providerData;
$("#username").text(displayName);
console.log("user");
// ...
} else {
// User is signed out.
// ...
window.location.replace("login.html");
}
});
function signOutFromGoogle () {
$("#username").text("Signing out...");
firebase.auth().signOut().then(function() {
window.location.replace("login.html");
}).catch(function(error) {
});
}
function showModal() {
$('.ui.modal')
.modal('show')
;
}
$('#dropdownly')
.dropdown({
on: 'hover',
action: 'nothing'
});