简体   繁体   English

如果app.js文件被编辑,它将停止工作

[英]app.js file stops working if it is edited

i am designing a webpage for a construction company using a template. 我正在使用模板为建筑公司设计网页。 the html file uses a js file called app.js. html文件使用一个名为app.js的js文件。 whenever i edit the js file, the whole html page becomes non-responsive as if the js file was never there to begin with. 每当我编辑js文件时,整个html页面都将变得无响应,就好像js文件从未出现过一样。 here is the code which exists in the app.js file. 这是app.js文件中存在的代码。

//animate first team member
jQuery('#first-person').bind('inview', function (event, visible) {
    if (visible == true) {
        jQuery('#first-person').addClass("animated pulse");
    } else {
        jQuery('#first-person').removeClass("animated pulse");
    }
});

//animate sectond team member
jQuery('#second-person').bind('inview', function (event, visible) {
    if (visible == true) {
        jQuery('#second-person').addClass("animated pulse");
    } else {
        jQuery('#second-person').removeClass("animated pulse");
    }
});

//animate thrid team member
jQuery('#third-person').bind('inview', function (event, visible) {
    if (visible == true) {
        jQuery('#third-person').addClass("animated pulse");
    } else {
        jQuery('#third-person').removeClass("animated pulse");
    }

the file works fine with this pre-written script. 该文件与此预写脚本可以正常工作。 but when i try to add the following line for a new id "fourth-person" i created in html file 但是,当我尝试为HTML文件中创建的新ID“第四人称”添加以下行时

 //animate fourth team member
 jQuery('#fourth-person').bind('inview', function (event, visible) {
    if (visible == true) {
        jQuery('#fourth-person').addClass("animated pulse");
    } else {
       jQuery('#fourth-person').removeClass("animated pulse");
    }

the html page becomes non-responsive. html页面变为无响应。 please tell me what might be the problem and a solution too if possible 请告诉我可能是什么问题,如果可能的话,也要提供解决方案

I can see at least two syntax problems, you are not closing the event binding for third-person and fourth-person elements. 我可以看到至少两个语法问题,您没有关闭第三人称和第四人称元素的事件绑定。 They should be like this: 他们应该是这样的:

//animate fourth team member
 jQuery('#fourth-person').bind('inview', function (event, visible) {
    if (visible == true) {
        jQuery('#fourth-person').addClass("animated pulse");
    } else {
       jQuery('#fourth-person').removeClass("animated pulse");
    }
 }); // <-- This is missing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM