I'm puzzled as to why TimeLineMax is undefined, it's a strange occurrence that I can't quite

Having some trouble with TimeLineMax animation - my console keeps showing an error: TimeLineMax is not defined. Can anyone assist me in fixing this issue? I've double-checked if the library was added properly, but still can't figure out what's causing the problem. Any tips or suggestions would be greatly appreciated.

const hero = document.querySelector('.t-header__hero');
const slider = document.querySelector('.c-slider');
const logo = document.querySelector('.t-header__logo');
const hamburger = document.querySelector('.t-header__burger');
const headline = document.querySelector('.t-header__headline');

const tl = new TimeLineMax();
tl.fromTo(hero, 1, {height: "0%"}, {height: "80%"});
.t-header {
  section {
    display: flex;
    height: 80vh;
    justify-content: center;
    align-items: center;
  }

  &__hero {
    height: 60%;
    width: 100%;
    position: relative;

    &::after{
      content: "";
      background: $black;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      opacity: 0.3;
    }

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &__headline{
    position: absolute;
    top: 70%;
    left: 10%;
    font-size: $font-size-1;
    transform: translate(-20%, -100%);
    color: $white;
    z-index: 3;
  }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TimelineMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<header class="t-header">
        <nav class="c-nav">
            <a class="t-header__logo" href="#"><img src="#" alt="Logo"></a>
            <img class="t-header__burger" src="images/burger-menu.png" alt="burger menu">
            <!-- mobile menu -->
            <!-- <div class="t-header__menu-mobile">
                    </div> -->
        </nav>

        <section>
            <div class="t-header__hero">
                <img src="images/mam-tor-5393685_1920.jpg" alt="">
                <h1 class="t-header__headline">Dream Big</h1>
            </div>
        </section>
    </header>

    <div class="c-slider"></div>

Answer №1

The correct function is TimelineMax(), with a lowercase "l", not TimeLineMax().

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

Locate Vue Components That Are Persisting

After loading my app and immediately taking a Chrome memory heap snapshot, I found the following results. https://i.stack.imgur.com/QB8u3.png Upon further exploration of my web app and then returning to the initial loaded page to take another memory heap ...

Searching for values within dynamic JSON arrays can be done using the jQuery.InArray

My Ajax request is fetching a JSON array that looks like this: [101, 102]. These are image ids from a database. I am trying to display all the images on my page with a checkbox next to each one. If the image_id matches any in the array, I want the checkbo ...

Does an href and click events both happen simultaneously?

JavaScript Purpose: Implement a series of loops and create anchor links with the 'href' attribute <a class="mui-control-item" v-for="(item, index) in dai" v-on:click ="abc(item)" :href="'#item'+(index+1)+ 'mobile'" ...

How can you identify the specific HTML page that a jQuery selector is targeting?

In an attempt to create jQuery code that counts the number of <img> elements on a website, I encountered a unique challenge. The website consists of 4 separate HTML pages stored in the same folder on the server. Among these pages, only "pics.html" is ...

Is there a performance impact when sorting JSON keys/attributes alphabetically?

Would arranging the keys in alphabetical order in a JSON file that represents a dictionary of words impact the search performance for word definitions in JavaScript, especially when dealing with thousands or more words? Does JSON and JavaScript have built ...

conceal elements created with JQuery within an AJAX function

Is it possible to use jQuery and the $.ajax() method to submit a form, displaying only the result while hiding other elements on the page? I am looking to add a conditional in the Ajax method that will show the result if successful, hiding certain elements ...

View the user's ID profile

Having trouble accessing user profiles? For example, as User 1, you want to view User 2's profile but when entering the URL (e.g. localhost/$userID), only information from your own profile (User 1) is displayed. Below is the HTML CODE for displaying ...

Unable to configure raycaster layers within Three.js framework

While attempting to configure the raycaster layer to only cast on a single layer, as outlined in the threejs documentation: - I encountered the following error Uncaught TypeError: Cannot read properties of undefined (reading 'set') What could b ...

Horizontal scroll functionality featured in a D3 bar graph

I'm currently working on implementing a bar graph with a selection dropdown that includes 3 values: By Date, By Week, By Month (where 'By Date' is the default option). When retrieving data from the backend for 'ByDate', I have a l ...

Complete guide to resetting every component in Vue.js

I'm attempting to trigger a reset of my component whenever the route changes: beforeRouteUpdate (to, from, next) { Object.assign(this.$data, this.$options.data()) console.log(to.query); next(); } Unfortunately, my current imple ...

Unable to achieve separation of borders within dash_table.DataTable styling using CSS by setting border-collapse: separate; considering using border-spacing instead

Is there a way to create space between the lines of a table in dash_table.DataTable using css or regular style capabilities? I have tried using border-collapse and border-spacing but it doesn't seem to be working. How can I achieve this desired spacin ...

Button in Angular requiring double-click to trigger the click event

Currently, I am in the process of building an application using Angular. The module I am focusing on allows users to either join an existing room or create a new one. Here is the initial UI design of the room module: https://gyazo.com/81afe2b5f7119326d00b ...

How can I use jsPDF to align text in the center of table cells?

Is there a way to center the text in table cells when generating a PDF with jsPdf? By default, the text is left-aligned and I'd like it to be centered. Best regards, Afroz Ali ...

What can I do to ensure that this nested footer stays fixed to the bottom of the page?

I've been experimenting with different approaches, but I'm struggling to find a solution for making the footer stay at the bottom of the page. The challenge arises from having multiple nested divs within each other. My goal is to have the border- ...

Ways to retrieve the value of the `data-listid` attribute

When using jQuery script and viewing the browser's console, I am able to see the following HTML element: <li class="fe_pui-autocomplete-box ui-draggable ui-sortable-helper" data-listid="latest_4604b40a-0492-49da-a86e-37f633501c2c" style="position: ...

Difficulty encountered when trying to map an array to JSX - Error: Unexpected token

I am struggling to properly map an employees array to a new array using ReactJS and JSX. It seems like there is an issue with my return method. Please keep in mind that I am a complete beginner when it comes to React and ES6. Can someone guide me on how t ...

Using template literals with Optional chaining in Javascript does not yield the expected results

Trying to implement template literal with optional chaining. type Item = { itemId:number, price: number}; type ItemType = { A:Item, B:Item }; const data : ItemType = { A:{itemId:1, price:2}, B:{itemId:2, price:3} }; let key = `data?.${variable}?.ite ...

Utilizing Google Apps Script to streamline the process of converting unnormalized data into normalized data within Google Sheets

I am working with a Google Spreadsheet that contains 3 separate raw data worksheets named 'Category1', 'Category2', and 'Category3'. These worksheets are regularly updated by different individuals in my company, but the data i ...

Tips for sending every individual string object within an array as post data via ajax

I have a scenario where I am dealing with dynamically generated text boxes. Each value from these text boxes needs to be stored in a JSON array when submitted. The approach I took was to push all the values into an array and upon submission, these values a ...

Storing an image created on an HTML5 canvas directly to your phone's storage

Working with Phonegap (javascript), my goal is to resize an image selected by the user from their gallery and save it to a different folder structure. I've tried various methods but none seem to be working for me. I have looked at similar questions o ...