JQuery .hover triggering unexpectedly without actually hovering

My current code is causing $('#intro').fadeOut to activate even when I am not hovering on $('arena').hover. Are there any other issues in the code that would prevent it from working correctly?

$(document).ready(function() {
  $('#arena').hover(); {
  $('#intro').fadeOut('slow'); {
      

    }
  }
});
html, body {
  padding: 0 autp;
  margin: 0 auto;
}



#cirkle {
  height: 150px;
  width: 150px;
  background-color: blue;
  border-radius: 25%;
  transition: all 1s ease-in-out;
  border: black 1px solid;
  position:relative; /*gotta put it here too to start it off*/
  top:35%;
  left:35%;
}
#intro {
  text-align: center;
  margin-top: 75px;
  overflow: hidden;
  font-family: 'Indie Flower', cursive;
  font-size: 50px;
}

body {
  background-color: #cccccc;
}

#cirkle:hover {
  border: black 1px solid;
  background-color: red;
  border-radius: 50%;
  height: 75px;
  width: 75px;
  transition: 1.5s;
  -webkit-animation-name: cruise;
  -webkit-animation-duration: 60s;
  animation-name: cruise;
  animation-duration: 50s;
  position:relative;
  top:50%;
  left:50%;
  transition: all 1s linear;
}

#arena {
  border: 5px dashed grey;
  margin: 0 auto;
  width: 550px;
  height: 550px;
  margin-top: 150px;
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
}

 @keyframes cruise {
    0%    {left:35%; top:35%;}
    5%    {left:40%; top:40%;}
    10%   {left:45%; top:45%;}
    15%   {left:50%; top:43%;}
    20%   {left:57%; top:50%;}
    25%   {left:67%; top:40%;}
    30%   {left:70%; top:27%;}
    35%   {left:55%; top:35%;}
    40%   {left:35%; top:67%;}
    45%   {left:15%; top:40%;}
    50%   {left:40%; top:65%;}
    55%   {left:50%; top:25%;}
    60%   {left:82%; top:65%;}
    65%   {left:26%; top:15%;}
    70%   {left:69%; top:70%;}
    75%   {left:85%; top:15%;}
    80%   {left:36%; top:78%;}
    85%   {left:65%; top:41%;}
    90%   {left:85%; top:26%;}
    95%   {left:58%; top:78%;}
    100%  {left:35%; top:35%;}
    }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<title>
            Test
        </title>
      
 
        <script src="script.js"> </script>
  
  <body>
      <h1 id="intro">
        <ins>HÅLL MUSEN PÅ DEN BLÅA FYRKANTEN</ins>
      </h1>
    <div id="arena">
        <div id="cirkle">

        </div>
    </div>

  </body>
</html>

Answer №1

Your code contains multiple syntax errors. In order to create a hover effect, you must pass a function as an argument.

Revise your code as follows:

$(document).ready(function() {
   $('#arena').hover(function() {
      $('#intro').fadeOut('slow');
   });
});

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 there a way to make the delete button remove just one item from the local storage?

Is there a way to make the delete button on each item in a list remove only that specific item without deleting the others and also remove it from local storage? I have been trying to figure this out but haven't had any success so far. <div class ...

Building a dynamic table in AngularJS that pulls information from a REST API

I'm looking to utilize AngularJS to present a table. The data for this table will be sourced from a REST API. Here's an example of the response I expect: { "value": 43, "C_class": [ 1, 2, 3, 4, 5, 6, 7, 8, ...

Revise the color of the selected image

click here for image description I'd like the area's color to change when the mouse hovers over it. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA ...

Create a stylish slide-in menu using CSS, triggered by an onclick event. No JavaScript required!

I implemented a hamburger menu that slides in when clicked. However, I'm facing an issue where the slide-in menu disappears after a second. How can I make sure the menu stays visible? #navigationWrap { position: fixed; top: 0; ...

Utilizing jQuery to Trigger a Click Event on an Element Without a Class

What is the best way to ensure that the "click" event will only be triggered by an href element unless it does not have the "disablelink" class? Avoid processing the following: <a class="iconGear download disablelink" href="#">Download</a> P ...

Tips for incorporating inline styling into the body element

Can someone help me with adding inline style to the body element using jQuery? I want to set the background color to white (#FFFFFF). Your assistance would be highly appreciated. Thank you! ...

What are the potential ways in which an html IMG tag can disrupt the functionality of this

For years, I have been using this form code without any issues. The code functions perfectly and all the tags are correct. However, whenever I include an image tag, it displays a failure message and prevents the mail function in PHP from working. The hea ...

adjust the dimensions of the clickable icon's background

Is there a way to expand the pressable area of a close icon without altering its size? For example, if the icon is 19X19 pixels, can the pressable area be increased to 39X39 pixels? The concern lies with the div element containing the close button and the ...

Javascript eval function providing inaccurate results

I have encountered a problem while using eval() for a calculator I am developing. When I input the following code: console.log(eval("5.2-5")); The output is: 0.20000000000000018 I am confused as to why this is happening. Thank you for your assistance. ...

Vertical location for a jQueryUI sortable within a nested structure

I am seeking a solution to implement a placeholder for sortable elements that can adapt based on their orientation. For instance: Vertical, if the element (.sortable-cell) is being moved to form a new cell in a row (.sortable-row) Horizontal, if the elem ...

How to target the first and last elements in a list using CSS

What's the best way to determine if a DOM element that is clicked is either the first 'li' element or the last 'li' element within an unordered list? ...

Using jQuery to iterate over a multi-dimensional array and showing the child elements for each parent array

I am facing an issue with a multidimensional array that contains objects and other arrays. While it is simple to loop through the parent array and display its contents in HTML, I encounter a problem when there are multiple layers of arrays nested within ea ...

Issue: unrecognized symbol

I encountered an issue that I need help with: When running my code, I received the following error at line 993, column 29 in http://localhost:1810/Titulares/Create?Length=9 0x800a03f6 - JavaScript Runtime Error: Invalid character The problematic code on ...

Issue encountered when attempting to remove an element from an array using the delete method

Whenever I attempt to remove an input that has been added, an error message saying "Value is NULL" pops up. I'm looking for a solution where only the selected inputs are deleted when I click on DELETE, instead of all inputs being removed. The myFuncti ...

Which target should be specified for pressing Enter in a Javascript Alert using Selenium IDE?

Seeking assistance with creating simple test cases using Selenium IDE. Encountering difficulties when recording test cases involving Javascript alerts, as Selenium does not support these pop-ups. Attempted a workaround by simulating the Enter key press wh ...

How can data be partitioned into individual td elements in Rails after a specific number of records?

Revamped solution: I made some changes to the original answer that guided me in the right direction. Here is my updated code snippet: <table class="fixed"> <tr> ...

The Jquery code is failing to execute the AJAX GET request

I've included jQuery in my code, but despite that, it seems like my script is not functioning properly. I suspect the issue lies with how I am loading jQuery rather than with my ajax request. There are no error messages appearing and the console.log ...

What are the reasons behind my inability to utilize the resources in the Django admin app?

I am trying to incorporate Django's contrib "admin" resources into my project. The "admin" package has a static directory with a file located at "static/admin/image/selector-icons.svg" that I want to reuse. Here is an excerpt from my settings.py: ST ...

Angular responsive button

Currently, I am working on an application using angular 8. In the app, there is a form that includes several buttons. I am looking for a solution to make these buttons responsive on mobile devices when viewed in Chrome and Firefox browsers. Here is the cur ...

JavaFX Animation for Charting

My FXML file contains a JavaFX AreaChart <AreaChart id="myAreaChart" onMouseClicked="#handleAreaChartMouseClicked" GridPane.columnIndex="0" GridPane.rowIndex="0" fx:id="myAreaChart" > <xAxis> <Nu ...