Editing the app.js file can cause it to malfunction and stop working

As I work on designing a webpage for a construction company using a template, I face an issue with the js file named app.js. Whenever I make edits to the script, the entire HTML page loses its responsiveness as if the js file was never included in the first place. Below is the snippet of code from the app.js file:

//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 second 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 third 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");
    }

Initially, the script above works without any issues. However, when I attempt to add a similar animation for a new ID "fourth-person" that I created in the HTML file, the webpage loses its responsiveness. I have included the additional script below:

 //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");
    }

If anyone can pinpoint what might be causing this problem and provide a solution, I would greatly appreciate it.

Answer №1

It appears that there are a couple of syntax errors in your code. You have forgotten to close the event binding for the third-person and fourth-person elements. The correct way to write it would be:

//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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is the accuracy of Chrome's inspect device not up to par?

I'm currently testing how the page appears on a 1366x768 laptop. When inspected in the device, it looks perfect: https://i.sstatic.net/OECnx.png However, on the actual laptop screen, it's completely off: https://i.sstatic.net/chaeY.png It&ap ...

What is the syntax for implementing a nested for loop in JavaScript within this particular scenario?

var entries = [ { "item": "something", "steps": [{ "node": {"name": "test0"}, "status": {"name": "test"}, "time": {"name": "test"} },{ "node": {"name": "test1"}, ...

The jQuery post function fails to transmit any data

I developed a basic application using jQuery's Get and Post methods to retrieve user data from a JSON file and append new users to it. In my index.html file, I have implemented a table that successfully displays users fetched via AJAX GET requests. H ...

In TypeScript, both 'module' and 'define' are nowhere to be found

When I transpile my TypeScript using "-m umd" for a project that includes server, client, and shared code, I encounter an issue where the client-side code does not work in the browser. Strangely, no errors are displayed in the browser console, and breakpoi ...

Ways to avoid grid overflow

As a newcomer to CSS grid, I am struggling to understand how to prevent components from overflowing a grid. The section in question, with the class name of profile-widget-wrapper, is defined with grid-row:2/4 but is overflowing the grid. Can anyone provide ...

I am experiencing difficulty with playing my embed file on Chrome as the request for the audio file is consistently being "canceled."

I implemented a feature on my webpage that uses jQuery to play a sound whenever users make an error. Here is a snippet of the HTML code: <embed id="beepCache" src="sound/beep.wav" autostart="false" type ="audio/x-wav" width="0" height="0" hidden="hidd ...

To add a <figure> tag before and after the <img> tag using PHP, simply include the opening <

My goal is to surround the image tag with a figure tag at the beginning and end. This is my current approach. <?php $v['content_en'] = '<p><br /><img alt="" src="https://66.media.tumblr.com/9dc27741114bd854f29fc65dc33 ...

I am experiencing issues with the functionality of the jQuery function

I am currently diving into the world of jquery. I put together a script, but unfortunately it's not functioning as expected. 1 Here is a snippet of my HTML code <ul id="recur" class="elasticstack"> <li id=<?=$item['id']?> ...

Tips for utilizing formidable with NextJS 13 API for image uploading and resolving request errors

I've been working on integrating image uploading functionality into my application. I'm currently using NextJS version 13.4.4 along with formidable@v3. However, whenever I attempt to upload an image, I encounter the following error: error TypeE ...

"Explore the Hong browser designed specifically for enhanced Ajax functionality

I made the decision to revamp my new job by incorporating Ajax into the mix. Here is the code snippet I used to load pages: html <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link rel="stylesheet" ...

What is the process for deleting a token from local storage and displaying the logout page in Next JS?

I developed a Next.js web application and am looking to display a logout page when the token expires, while also removing the expired token from local storage. How can I ensure that this functionality works no matter which page the user visits within the a ...

Convert HTML to PDF and ensure that the table fits perfectly on an A4

I am currently utilizing html-pdf to convert my table data into a PDF format. The issue I am facing is that the table content exceeds the specified A4 paper size in such a way that two columns are completely missing in the generated PDF. However, when I c ...

Attempting to show different fields depending on the chosen option

Having an issue with the signup process for my team and competition setup. I want to implement a feature where, if the user selects 'Competition', the promo code field will be displayed. However, this field should only appear when 'Competiti ...

What causes background-color to create gaps of white space?

How can I remove the white spaces on the right and left side of a section when applying a background-color? https://i.sstatic.net/WbVuv.png I want the background-color to fill out the entire width of the section. Should I use extra padding to solve this ...

Spin the sphere texture in Three.js

Currently, I am working on rendering a sphere through three.js. While applying a texture to the sphere works well, I am having some difficulties rotating the texture to align it with marker positions. The issue arises when trying to place markers over Kag ...

There appears to be an issue with Mongoose Unique not functioning properly, as it is allowing

Below is the complete code snippet I am using to validate user data: import { Schema, model } from 'mongoose'; import { User } from './user.interface'; const userSchema = new Schema<User>({ id: { type: Number, required: ...

Create a dynamic animation of an image expanding and shifting towards the center of its parent container

Is it possible to animate an SVG image within a div to grow to 80% screen height and move to the center of the parent div when a specific function is called? If so, how can this be achieved? function openNav(){ $("#topnav").animate({height:'100%& ...

What steps should I take to ensure this image automatically refreshes once it has been uploaded?

I have granted permission for administrative staff on our ASP.NET website to upload their profile pictures. The process is simple: just use basic file uploading controls: <img src="<%#ImageFile%>" border='0' width="150" alt="" height="1 ...

Implementing automatic page breaks in Laravel using the mpdf libraryLet me know

I am attempting to automatically add a page break if the data exceeds 10. I am using mpdf in conjunction with Laravel and Vue. Below is my CSS code: <style> div.breakNow { page-break-inside:avoid; page-break-after:always; } </style> This is t ...

Is there a way to generate a fresh array by filtering an array of objects based on a single value?

I am currently working with an array of objects: const dummyLinkRows = [ { id: 'entity:link/1:en', categories: [ { name: 'Human Resources' }, { name: 'Social' } ], nam ...