令人沮丧的Java错误

时间:2018-06-22 19:25:43

标签: javascript html css

我的Jquery在文本编辑器(如StackOverflow上的小提琴和摘录)上运行良好,但是一旦将其放在Brackets中,甚至在Github上将其打开,导航栏的向下滚动动画均不起作用。 Here是到小提琴的链接,在这里我使用了与括号和Github Pages.中使用的完全相同的代码(我只是使用了随机的背景图片)。

int correctIndex=newQuestion(questionTextView,answerButtons);//CREATES A NEW QUESTION and returns the correct index (0-3);

answerButtons[correctIndex].setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        correctDialog(questionTextView,answerButtons);
    }
});

for (int i = 0; i < 4; i++) {
    final int j = i;
    if (j != correctIndex) {
        answerButtons[j].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                wrongDialog(questionTextView, answerButtons);
            }
        });
    }
}
$(document).ready(function() {
    $(window).scroll(function() {
        if ($(document).scrollTop() > 10) {
            $('#nav').addClass('shrink');
        } else {
            $('#nav').removeClass('shrink');
        }
    });
});
/**********BODY GENERAL**********/
body {
    margin: 0;
    height: 2500px;
    /* just to demonstrate how it will looks with content */
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}

/* Fix this one day */
.bg-img {
    background: url('https://orig00.deviantart.net/2106/f/2012/329/0/e/untitled_drawing_by_walktheinch-d5m49xe.png') no-repeat center center;
    background-size: cover;
    height: 100vh;
}

strong {
    font-weight: bold;
}

/*********NAVIGATION*********/
@media screen and (max-width: 900px) {
    nav {
        grid-template-columns: 100%;
        grid-template-rows: auto;
        grid-gap: 1em;
    }
}

.menu1 {
    grid-column: 1;
}

.menu2 {
    grid-column: 2;
}

.logo {
    grid-column: 3;
    font-family: 'Montserrat', sans-serif;
    font-weight: lighter;
    font-size: 28px;
    width: 500px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    height: 7vh;
    margin-bottom: 25px;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.menu3 {
    grid-column: 4;
}

.menu4 {
    grid-column: 5;
}


/**************HOVER ANIMATION**************/
div>a {
    font-family: 'Raleway';
    text-transform: uppercase;
    text-decoration: none;
    color: #000;
    position: relative;
    font-size: 0.8rem;
}

div>a:hover {
    color: #000;
}

div>a:before {
    content: "";
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -4px;
    left: 0;
    background-color: #000;
    visibility: hidden;
    -webkit-transform: scaleX(0);
    transform: scaleX(0);
    -webkit-transition: all 0.3s ease-in-out 0s;
    transition: all 0.3s ease-in-out 0s;
}

div>a:hover:before {
    visibility: visible;
    -webkit-transform: scaleX(1);
    transform: scaleX(1);
}

/**********MAIN HEADER***********/
header {
    color: white;
    justify-content: center;
    align-content: center;
    top: 0;
    bottom: 0;
    left: 0;
}

/**********BODY*****************/
.Minfo {
    color: red;
    width: 100%;
    padding-top: 100px;
    font-family: 'Montserrat', sans-serif;
    font-weight: lighter;
}

.subtitle {
    padding-left: 4em;
    padding-top: 29em;
    font-size: 100%;
    color: #fff;
}

.title {
    font-size: 3em;
    text-align: left;
    color: #FFF;
    padding-bottom: 0px;
}

.subtext {
    padding-top: 0px;
    color: #FFF;
}

/************* NAV TRASPARENT TO OPAQUE ANIMATION *************/
nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 1em;
    grid-auto-rows: auto;
    text-align: center;
    align-items: center;
    background: transparent;
    */ z-index: 100;
    transition: all ease .5s;
    height: 70px;
    position: relative;
}

/*============= NEW CSS RULES ============*/

#nav {
  position: relative;
}

#nav .logo p {
  margin: 10px 0;
}

#nav .background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: #ededed;
  height: 0;
  transition: height 800ms ease;
}

#nav.shrink .background {
  height: 100%;
}

1 个答案:

答案 0 :(得分:3)

这里是PR:https://github.com/killerchef732/ItsAcademic/pull/2

基本上,您没有在页面中包含脚本标签(<script src="script.js"></script>),并且script.js文件的末尾还有一些垃圾(÷ ,)。

首先,我注意到您的页面甚至没有脚本代码。 然后,一旦我添加了它,chrome开发者控制台就会向我显示它遇到错误。