What's causing my text to slowly appear while my HTML canvas remains static and unchanged?

Can someone take a look at my code: http://jsfiddle.net/7y9Gp/2/

I've been struggling with trying to fade in and out text or images, but for some reason, my canvas object refuses to cooperate. I've tried swapping the position of the canvas with the text in the code, but still no luck. Could anyone provide guidance on how to properly fade in a canvas object?

HTML:

<head>
    <script src="http://code.jquery.com/jquery-1.4.4.min.js" type="text/javascript"></script>


<script type="text/javascript">
$(document).ready(function() {
    $('#picOne').delay(1000).fadeIn(2000).delay(2500);
    $('#picTwo').delay(500).fadeIn(2500).delay(2000);
    $('#picThree').delay(4000).fadeIn(2500).delay(2000);

});
</script>
</head>
<body>

<div id="pics" align="center">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>

<td valign="middle" align="center">
<table cellpadding="0" cellspacing="0" border="0">

        <tr>
        <td align="center" valign="middle"><font size="200" id="picOne" color="black">SOME TEXT</font></td>
        </tr>

        <tr><td align="center" valign="middle">        

            <script type="text/javascript" src="http://hakim.se/experiments/html5/trail/01/js/three.js"></script>
<script type="text/javascript" src="http://hakim.se/experiments/html5/trail/01/js/trail.js"></script>



<div id="picTwo">
<canvas width="640" height="480" id="my-image"></canvas>
</div>
</td>
        </tr>

</table>
</td>
</tr>
</table>

</div>

CSS:

#picOne, #picTwo {
position:relative;
display: none;
float:center;
    top: 280px;
    left: 0px;
    z-index: 1;
}

#pics {
}


#my-image {
  position: absolute;
    top: 0px;
    left: 0px;
    z-index: 3;
}​

Answer №1

Take a look at this demonstration: http://jsfiddle.net/7y9Gp/11/

In the code, it is expected to locate a canvas within the div#picTwo, but it seems that either trail.js or three.js creates its own canvas (or something similar - further investigation is required). Therefore, if you replace:

$('#picTwo').delay(500).fadeIn(2500).delay(2000);

with

$('canvas').delay(500).fadeOut(2500).delay(2000);

The above modification will work correctly (changing from fadeIn to

fadeOut</code simply demonstrates functionality as the element is initially visible and <code>fadeIn
would not have any effect).

In essence, the issue lies in attempting to apply fadeIn/fadeOut on the incorrect object.

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

issue with JavaScript canvas

My task is to develop a Blackberry application, but I have limited knowledge in Java. Since the application requires drawing capabilities, I decided to use HTML5 and JavaScript instead. I started reading some JavaScript tutorials to prepare for this proj ...

What is the reason behind the issue where max-height disrupts border-radius?

My inline svg is styled with the following CSS: .img { border-radius: 15px; overflow: hidden; max-width: 70vw; margin-top: 6vh; max-height: 50vh; z-index: -1; text-align: center; } Everything seems to work as expected, except f ...

Issue with the Navigation in CSS and jQuery

I'm struggling to understand a problem with the desktop navigation on this website, specifically in Safari on certain pages. The issue seems to only occur on Safari for Windows, Mac Desktop, and Mac Laptop. Interestingly, the navigation works perfect ...

Ionic 4: Facing issues with setting complete background image on ion-card

https://i.stack.imgur.com/3lH6h.png I'm currently attempting to set a background image for an Ion-card in order to completely cover the card's area. However, I'm facing an issue where the background image does not cover the entire area and ...

What is the best way to position an element on the left side of the navbar without having it animated?

Could someone assist me in placing the Life's Good logo on the left side of the nav bar without applying the animation from the "btn" class? Below is a snippet of my code with an example where I want the logo highlighted in Yellow: * { padding:0; m ...

Angular Js: Displaying JSON Object with Multiple Nested Layers

Looking for a way to display a menu using Angular and JSON object that utilizes ul and li. Trying to achieve this using ng-repeat, but encountering challenges when dealing with deeply nested objects. Here's the HTML code: <ul> <li ng-rep ...

What is the best way to make ng-style append to a pre-existing style?

I am facing an issue with my custom popover directive and another custom directive that uses it. I am attempting to use ng-style to adjust the width of the popover. Below is a code snippet from the directive's html template: <div my-custom-popover ...

Using HTML's select option to submit a request for data retrieval from PHP using PDO with MySql database

I am having an issue with fetching data from MySQL based on Select Month and Year in HTML Select Option. When I submit the view, the table should be filtered accordingly. Otherwise, all data should be displayed. However, my code is generating an error. No ...

Learn how to display only certain elements when triggered by the click of another

I have developed a tab system where each tab contains a unique set of questions and answers. The structure of the tabs is exactly as I envisioned, but I am facing challenges with toggling the display of answers when their respective questions are clicked. ...

The page fails to load when redirected, however, it briefly displays the page upon clicking the back button before navigating back to the previous page

Currently, I am working with Angular 2 and encountering an issue when attempting to click on a link. The loading bar continues to progress without displaying the data or HTML content on the page. Furthermore, if I try to go back to the previous page, the i ...

Update the font URL in Bootstrap 5

I am looking to update the URL that Bootstrap uses to access fonts, as I want to host them on my server instead of relying on users to fetch them from Google with each page load. However, despite my efforts, I cannot locate the specific URLs mentioned when ...

Tips for automatically resizing a canvas to fit the content within a scrollable container?

I have integrated PDF JS into my Vue3 project to overlay a <canvas id="draw_canvas"> on the rendered pdf document. This allows me to draw rectangles programmatically over the pdf, serving as markers for specific areas. The rendering proces ...

Implementing Content-Security-Policy for a web application embedded in an iframe

Hey there! I've got this cool webapp called myApp, developed using Spring Boot and Vaadin. It's going to be deployed on a Tomcat server at http://tomcatserver:8080/myApp Now, what I want to do is display the webapp in an iframe like this: <if ...

"Disappearing act: Navigating through pages causes the navigation

Struggling with navigation in my asp.net core web app development. My directory structure includes the use of Areas. When navigating through pages in the main folder like Index, Index1, and Private, everything works fine. However, once I navigate to an Ar ...

retrieve data with the help of DOMDocument

I'm currently working on extracting a specific value from the HTML snippet below using DOMDocument: <h3> <meta itemprop="priceCurrency" content="EUR">€ <meta itemprop="price" content="465.0000">465 </h3> The value ...

Deactivate one select box depending on the value chosen in another select box

I am looking to disable one select box when the other select box equals 1, and vice versa. While I know how to achieve this with IDs, the challenge arises as the select boxes I want to target have dynamically generated IDs and names via PHP. Therefore, I n ...

Intersecting table columns with a different data table

My task is to create a table with a column that contains another table, where I want the colors of each alternating row to be different. Please refer to the image below (ignore the "CharacterAgain" column). Below is an example of AngularJS code for the ta ...

Add a CSS class to a dropdown menu option in HTML and JavaScript (JQuery) if it has a specified ID

I am brand new to HTML and JQuery, and I'm struggling with setting a class for my select element when the currently selected option has an ID of "answer". This is crucial for checking the correctness of a multiple choice question. If achieving this i ...

An effective way to emphasize the full area of a list item when hovering over it

Is there a way to modify the hover behavior of a list item in Fiddle? I'd like the black highlight to cover the entire area of the list item, without leaving any white space on top or bottom. Currently, it only covers the center area of the list item. ...

Constructing a horizontal slider using vertically floating divs

Struggling to create a basic horizontal image slider using overflow:hidden and floating divs. Despite efforts, the divs keep stacking vertically instead of horizontally. Numerous online examples have been attempted without success. HTML: <div id="slid ...